reduced time to wait for UDP broadcast answer to auto-detect network server
[rocksndiamonds.git] / src / network.c
index e21de8c5859c47b1f5e1dcae2cda6678f8704715..cabcfd3030485ce0b55fc24ba40f363f171bb89f 100644 (file)
@@ -219,7 +219,7 @@ boolean ConnectToServer(char *hostname, int port)
 
     DrawNetworkText("Looking for local network server ...");
 
-    if (SDLNet_CheckSockets(udp_socket_set, 1000) == 1)
+    if (SDLNet_CheckSockets(udp_socket_set, 500) == 1)
     {
       int num_packets = SDLNet_UDP_Recv(udp, &packet);
 
@@ -297,10 +297,8 @@ boolean ConnectToServer(char *hostname, int port)
   StartNetworkServer(port);
 
   /* wait for server to start up and try connecting several times */
-  for (i = 0; i < 6; i++)
+  for (i = 0; i < 30; i++)
   {
-    Delay(500);                        /* wait 500 ms == 0.5 seconds */
-
     if ((sfd = SDLNet_TCP_Open(&ip)))          /* connected */
     {
       DrawNetworkText_Success("Successfully connected!");
@@ -308,6 +306,8 @@ boolean ConnectToServer(char *hostname, int port)
       SDLNet_TCP_AddSocket(rfds, sfd);
       return TRUE;
     }
+
+    Delay(100);
   }
 
   DrawNetworkText_Failed("Failed to connect to network server!");