fix: add enabled arg to setNonBlocking
This commit is contained in:
@@ -103,13 +103,18 @@ struct HttpStream
|
|||||||
/*
|
/*
|
||||||
platform specific stuff
|
platform specific stuff
|
||||||
*/
|
*/
|
||||||
void setNonBlocking(SOCKET s)
|
void setNonBlocking(SOCKET s, bool enabled)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
unsigned long mode = 1;
|
unsigned long mode = enabled ? 1 : 0;
|
||||||
ioctlsocket(s, FIONBIO, &mode);
|
ioctlsocket(s, FIONBIO, &mode);
|
||||||
#else
|
#else
|
||||||
fcntl(s, F_SETFL, fcntl(s, F_GETFL, 0) | O_NONBLOCK);
|
int flags = fcntl(s, F_GETFL, 0);
|
||||||
|
if (enabled)
|
||||||
|
flags |= O_NONBLOCK;
|
||||||
|
else
|
||||||
|
flags &= ~O_NONBLOCK;
|
||||||
|
fcntl(s, F_SETFL, flags);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user