summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZack Middleton <zturtleman@gmail.com>2012-06-19 22:36:54 +0000
committerTim Angus <tim@ngus.net>2013-01-12 20:41:22 +0000
commit6d72acf65c8d0daf6fabcb84b7771756265a4daf (patch)
tree1dc04843d8681b42e836c7d704032a902370951f /src
parent6dcbcd8b21425a6054a1ebb2f0b7f213d08c8334 (diff)
- Have NET_Sleep work with Windows' INVALID_SOCKET again... - Use SOCKET_ERROR in NET_Sleep.
Diffstat (limited to 'src')
-rw-r--r--src/qcommon/net_ip.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/qcommon/net_ip.c b/src/qcommon/net_ip.c
index 84396472..18a21681 100644
--- a/src/qcommon/net_ip.c
+++ b/src/qcommon/net_ip.c
@@ -1629,7 +1629,7 @@ void NET_Event(fd_set *fdr)
// com_dropsim->value percent of incoming packets get dropped.
if(rand() < (int) (((double) RAND_MAX) / 100.0 * (double) net_dropsim->value))
continue; // drop this packet
- }
+ }
if(com_sv_running->integer)
Com_RunAndTimeServerPacket(&from, &netmsg);
@@ -1669,14 +1669,11 @@ void NET_Sleep(int msec)
if(ip6_socket != INVALID_SOCKET)
{
FD_SET(ip6_socket, &fdr);
-
- if(ip6_socket > highestfd)
+
+ if(highestfd == INVALID_SOCKET || ip6_socket > highestfd)
highestfd = ip6_socket;
}
- timeout.tv_sec = msec/1000;
- timeout.tv_usec = (msec%1000)*1000;
-
#ifdef _WIN32
if(highestfd == INVALID_SOCKET)
{
@@ -1686,9 +1683,12 @@ void NET_Sleep(int msec)
}
#endif
+ timeout.tv_sec = msec/1000;
+ timeout.tv_usec = (msec%1000)*1000;
+
retval = select(highestfd + 1, &fdr, NULL, NULL, &timeout);
-
- if(retval < 0)
+
+ if(retval == SOCKET_ERROR)
Com_Printf("Warning: select() syscall failed: %s\n", NET_ErrorString());
else if(retval > 0)
NET_Event(&fdr);