net/SocketDescriptor: AcceptNonBlock() enables non-blocking even if SOCK_NONBLOCK is unavailable

This commit is contained in:
Max Kellermann 2017-08-11 09:03:25 +02:00
parent e38c213ee0
commit b234f4307f

View File

@ -77,6 +77,8 @@ SocketDescriptor::AcceptNonBlock(StaticSocketAddress &address) const
SOCK_CLOEXEC|SOCK_NONBLOCK);
#else
int connection_fd = ::accept(Get(), address, &address.size);
if (connection_fd >= 0)
SocketDescriptor(connection_fd).SetNonBlocking();
#endif
return SocketDescriptor(connection_fd);
}