Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#10150) No civserver - 50 sec delay
Home

[Freeciv-Dev] (PR#10150) No civserver - 50 sec delay

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10150) No civserver - 50 sec delay
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Thu, 16 Sep 2004 14:59:31 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10150 >

After forking, we try to connect to the server for 50sec. After that
time we assume that the server is dead or hangs.
But we can easily check if the child exited or returned from the last
execv().
This patch implements it.
It removes the felling that the client hangs when there's no server
installed.
--
mateusz
Index: connectdlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/connectdlg_common.c,v
retrieving revision 1.21
diff -u -r1.21 connectdlg_common.c
--- connectdlg_common.c 25 Aug 2004 18:09:58 -0000      1.21
+++ connectdlg_common.c 16 Sep 2004 21:58:18 -0000
@@ -304,7 +304,13 @@
   while (connect_to_server(user_name, "localhost", internal_server_port, 
                            buf, sizeof(buf)) == -1) {
     myusleep(WAIT_BETWEEN_TRIES);
-
+#ifdef HAVE_WORKING_FORK
+#ifndef WIN32_NATIVE
+    if (waitpid(server_pid, NULL, WNOHANG) != 0) {
+      break;
+    }
+#endif
+#endif
     if (connect_tries++ > NUMBER_OF_TRIES) {
       break;
     }

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#10150) No civserver - 50 sec delay, Mateusz Stefek <=