Author: cazfi
Date: Sun Aug 30 16:24:03 2015
New Revision: 29740

URL: http://svn.gna.org/viewcvs/freeciv?rev=29740&view=rev
Log:
Destroy "eot" timer also when the server exits via /quit mid-game.

See bug #23826

Modified:
    branches/S2_5/server/srv_main.c

Modified: branches/S2_5/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/srv_main.c?rev=29740&r1=29739&r2=29740&view=diff
==============================================================================
--- branches/S2_5/server/srv_main.c     (original)
+++ branches/S2_5/server/srv_main.c     Sun Aug 30 16:24:03 2015
@@ -175,6 +175,9 @@
 /* server initialized flag */
 static bool has_been_srv_init = FALSE;
 
+/* time server processing at end-of-turn */
+static struct timer *eot_timer = NULL;
+
 /**************************************************************************
   Initialize the game seed.  This may safely be called multiple times.
 **************************************************************************/
@@ -1396,6 +1399,9 @@
 **************************************************************************/
 void server_quit(void)
 {
+  if (eot_timer != NULL) {
+    timer_destroy(eot_timer);
+  }
   set_server_state(S_S_OVER);
   mapimg_free();
   server_game_free();
@@ -2268,7 +2274,6 @@
 **************************************************************************/
 static void srv_running(void)
 {
-  struct timer *eot_timer;     /* time server processing at end-of-turn */
   int save_counter = 0, i;
   bool is_new_turn = game.info.is_new_game;
   bool skip_mapimg = !game.info.is_new_game; /* Do not overwrite start-of-turn 
image */
@@ -2280,7 +2285,6 @@
   log_verbose("srv_running() mostly redundant send_server_settings()");
   send_server_settings(NULL);
 
-  eot_timer = timer_new(TIMER_CPU, TIMER_ACTIVE);
   timer_start(eot_timer);
 
   /* 
@@ -2415,7 +2419,7 @@
   /* This will thaw the reports and agents at the client.  */
   lsend_packet_thaw_client(game.est_connections);
 
-  timer_destroy(eot_timer);
+  timer_clear(eot_timer);
 }
 
 /**************************************************************************
@@ -2502,6 +2506,8 @@
       exit(EXIT_FAILURE);
     }
   }
+
+  eot_timer = timer_new(TIMER_CPU, TIMER_ACTIVE);
 }
 
 /**************************************************************************


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to