Get rid of duplicated code
Addresses #435 git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7293 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
ab6b694420
commit
ba9d49acd5
|
@ -516,18 +516,14 @@ static bool setSocketBlocking(const SOCKET fd, bool blocking)
|
|||
sockopts |= O_NONBLOCK;
|
||||
|
||||
if (fcntl(fd, F_SETFL, sockopts) == SOCKET_ERROR)
|
||||
{
|
||||
debug(LOG_NET, "Failed to set socket %sblocking: %s", (blocking ? "" : "non-"), strsockerror(getSockErr()));
|
||||
return false;
|
||||
}
|
||||
#elif defined(WZ_OS_WIN)
|
||||
unsigned long nonblocking = !blocking;
|
||||
if (ioctlsocket(fd, FIONBIO, &nonblocking) == SOCKET_ERROR)
|
||||
#endif
|
||||
{
|
||||
debug(LOG_NET, "Failed to set socket %sblocking: %s", (blocking ? "" : "non-"), strsockerror(getSockErr()));
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue