Commit b1806044 authored by Max Kellermann's avatar Max Kellermann

net/SocketDescriptor: implement SetNonBlocking() on Windows

parent fab12ef2
...@@ -181,6 +181,17 @@ SocketDescriptor::GetError() ...@@ -181,6 +181,17 @@ SocketDescriptor::GetError()
: errno; : errno;
} }
#ifdef _WIN32
bool
SocketDescriptor::SetNonBlocking() noexcept
{
u_long val = 1;
return ioctlsocket(fd, FIONBIO, &val) == 0;
}
#endif
bool bool
SocketDescriptor::SetOption(int level, int name, SocketDescriptor::SetOption(int level, int name,
const void *value, size_t size) const void *value, size_t size)
......
...@@ -98,6 +98,8 @@ public: ...@@ -98,6 +98,8 @@ public:
using FileDescriptor::Duplicate; using FileDescriptor::Duplicate;
using FileDescriptor::Close; using FileDescriptor::Close;
#else #else
bool SetNonBlocking() noexcept;
/** /**
* This method replaces FileDescriptor::Close(), using closesocket() * This method replaces FileDescriptor::Close(), using closesocket()
* on Windows. FileDescriptor::Close() is not virtual, so be * on Windows. FileDescriptor::Close() is not virtual, so be
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment