~ubuntu-branches/ubuntu/wily/mongodb/wily

« back to all changes in this revision

Viewing changes to src/mongo/util/net/sock_test.cpp

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-26 09:41:32 UTC
  • mfrom: (1.2.25)
  • Revision ID: package-import@ubuntu.com-20130826094132-8cknfm4syxyip1zt
Tags: 1:2.4.6-0ubuntu1
* New upstream point release.
* d/control,d/tests/*: Add autopkgtests for server process and client
  shell functionality.

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
    typedef boost::shared_ptr<Socket> SocketPtr;
49
49
    typedef std::pair<SocketPtr, SocketPtr> SocketPair;
50
50
 
51
 
    // On UNIX, make a connected pair of PF_LOCAL sockets via the native 'socketpair' call. The
52
 
    // 'type' parameter should be one of SOCK_STREAM, SOCK_DGRAM, SOCK_SEQPACKET, etc. For
53
 
    // Win32, we don't have a native socketpair function, so we hack up a connected PF_INET
 
51
    // On UNIX, make a connected pair of PF_LOCAL (aka PF_UNIX) sockets via the native 'socketpair'
 
52
    // call. The 'type' parameter should be one of SOCK_STREAM, SOCK_DGRAM, SOCK_SEQPACKET, etc.
 
53
    // For Win32, we don't have a native socketpair function, so we hack up a connected PF_INET
54
54
    // pair on a random port.
55
55
    SocketPair socketPair(const int type, const int protocol = 0);
56
56
 
184
184
#else
185
185
    // We can just use ::socketpair and wrap up the result in a Socket.
186
186
    SocketPair socketPair(const int type, const int protocol) {
187
 
        const int domain = PF_LOCAL;
 
187
        // PF_LOCAL is the POSIX name for Unix domain sockets, while PF_UNIX
 
188
        // is the name that BSD used.  We use the BSD name because it is more
 
189
        // widely supported (e.g. Solaris 10).
 
190
        const int domain = PF_UNIX;
188
191
 
189
192
        int socks[2];
190
193
        const int result = ::socketpair(domain, type, protocol, socks);