net/SocketDescriptor: fix SOCK_NONBLOCK flag in CreateSocketPairNonBlock()
This commit is contained in:
parent
e092eadd8d
commit
ebf607eef8
|
@ -170,7 +170,7 @@ SocketDescriptor::CreateNonBlock(int domain, int type, int protocol) noexcept
|
|||
|
||||
bool
|
||||
SocketDescriptor::CreateSocketPair(int domain, int type, int protocol,
|
||||
SocketDescriptor &a,
|
||||
SocketDescriptor &a,
|
||||
SocketDescriptor &b) noexcept
|
||||
{
|
||||
#ifdef SOCK_CLOEXEC
|
||||
|
@ -189,17 +189,17 @@ SocketDescriptor::CreateSocketPair(int domain, int type, int protocol,
|
|||
|
||||
bool
|
||||
SocketDescriptor::CreateSocketPairNonBlock(int domain, int type, int protocol,
|
||||
SocketDescriptor &a,
|
||||
SocketDescriptor &a,
|
||||
SocketDescriptor &b) noexcept
|
||||
{
|
||||
#ifdef SOCK_CLOEXEC
|
||||
/* implemented since Linux 2.6.27 */
|
||||
type |= SOCK_CLOEXEC;
|
||||
#ifdef SOCK_NONBLOCK
|
||||
type |= SOCK_NONBLOCK;
|
||||
#endif
|
||||
|
||||
if (!CreateSocketPair(domain, type, protocol, a, b))
|
||||
return false;
|
||||
|
||||
#ifndef __linux__
|
||||
#ifndef SOCK_NONBLOCK
|
||||
a.SetNonBlocking();
|
||||
b.SetNonBlocking();
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue