[quake3-commits] r2287 - trunk/code/qcommon

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Tue Jun 19 18:36:54 EDT 2012


Author: ztm
Date: 2012-06-19 18:36:54 -0400 (Tue, 19 Jun 2012)
New Revision: 2287

Modified:
   trunk/code/qcommon/net_ip.c
Log:
- Have NET_Sleep work with Windows' INVALID_SOCKET again...
- Use SOCKET_ERROR in NET_Sleep.

Modified: trunk/code/qcommon/net_ip.c
===================================================================
--- trunk/code/qcommon/net_ip.c	2012-06-19 16:12:16 UTC (rev 2286)
+++ trunk/code/qcommon/net_ip.c	2012-06-19 22:36:54 UTC (rev 2287)
@@ -1632,7 +1632,7 @@
 				// 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);
@@ -1672,14 +1672,11 @@
 	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)
 	{
@@ -1689,9 +1686,12 @@
 	}
 #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);



More information about the quake3-commits mailing list