Get rid of duplicated code

Addresses #435

git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7293 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2009-05-03 15:17:51 +00:00 committed by Git SVN Gateway
parent ab6b694420
commit ba9d49acd5
1 changed files with 1 additions and 5 deletions

View File

@ -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;
}