aboutsummaryrefslogtreecommitdiffstats
path: root/code/qcommon/net_ip.c
diff options
context:
space:
mode:
Diffstat (limited to 'code/qcommon/net_ip.c')
-rw-r--r--code/qcommon/net_ip.c36
1 files changed, 10 insertions, 26 deletions
diff --git a/code/qcommon/net_ip.c b/code/qcommon/net_ip.c
index dadfbd3..8b56b30 100644
--- a/code/qcommon/net_ip.c
+++ b/code/qcommon/net_ip.c
@@ -1026,43 +1026,27 @@ void NET_Shutdown( void ) {
====================
NET_Sleep
-Sleeps msec or until something happens on the network or stdin
+Sleeps msec or until something happens on the network
====================
*/
void NET_Sleep( int msec ) {
struct timeval timeout;
fd_set fdset;
- int highestfd = 0;
if (!com_dedicated->integer)
return; // we're not a server, just run full speed
- FD_ZERO(&fdset);
-
- FD_SET(fileno(stdin), &fdset);
- highestfd = fileno(stdin) + 1;
+ if (!ip_socket)
+ return;
- if(ip_socket)
- {
- FD_SET(ip_socket, &fdset); // network socket
- if(ip_socket >= highestfd)
- highestfd = ip_socket + 1;
- }
+ if (msec < 0 )
+ return;
- if(highestfd)
- {
- if(msec >= 0)
- {
- timeout.tv_sec = msec/1000;
- timeout.tv_usec = (msec%1000)*1000;
- select(highestfd, &fdset, NULL, NULL, &timeout);
- }
- else
- {
- // Block indefinitely
- select(highestfd, &fdset, NULL, NULL, NULL);
- }
- }
+ FD_ZERO(&fdset);
+ FD_SET(ip_socket, &fdset);
+ timeout.tv_sec = msec/1000;
+ timeout.tv_usec = (msec%1000)*1000;
+ select(ip_socket+1, &fdset, NULL, NULL, &timeout);
}