diff options
author | thilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2006-08-18 02:10:02 +0000 |
---|---|---|
committer | thilo <thilo@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2006-08-18 02:10:02 +0000 |
commit | 58c4b737379c71aafcc7db6a1fe1b695ee75d864 (patch) | |
tree | 21bab7d45a6ca2b7be693b0ec19c9bd543a85d06 | |
parent | f053285852be89ef4238b1a6682a63233501f342 (diff) | |
download | ioquake3-aero-58c4b737379c71aafcc7db6a1fe1b695ee75d864.tar.gz ioquake3-aero-58c4b737379c71aafcc7db6a1fe1b695ee75d864.zip |
Tweak the select() stuff a bit still.
git-svn-id: svn://svn.icculus.org/quake3/trunk@851 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r-- | code/unix/unix_net.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/code/unix/unix_net.c b/code/unix/unix_net.c index 12908eb..d214699 100644 --- a/code/unix/unix_net.c +++ b/code/unix/unix_net.c @@ -651,7 +651,7 @@ void NET_Sleep(int msec) struct timeval timeout; fd_set fdset; extern qboolean stdin_active; - qboolean not_empty = qfalse; + int highestfd = 0; if (!com_dedicated->integer) return; // we're not a server, just run full speed @@ -660,27 +660,27 @@ void NET_Sleep(int msec) if (stdin_active) { FD_SET(0, &fdset); // stdin is processed too - not_empty = qtrue; + highestfd = 1; } if(ip_socket && com_sv_running->integer) { FD_SET(ip_socket, &fdset); // network socket - not_empty = qtrue; + if(ip_socket >= highestfd) + highestfd = ip_socket + 1; } - // There's no reason to call select() with an empty set. - if(not_empty) + if(highestfd) { if(msec >= 0) { timeout.tv_sec = msec/1000; timeout.tv_usec = (msec%1000)*1000; - select(ip_socket+1, &fdset, NULL, NULL, &timeout); + select(highestfd, &fdset, NULL, NULL, &timeout); } else { // Block indefinitely - select(ip_socket+1, &fdset, NULL, NULL, NULL); + select(highestfd, &fdset, NULL, NULL, NULL); } } } |