Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2005:
[Freeciv-Dev] (PR#14305) Client crash on /endgame
Home

[Freeciv-Dev] (PR#14305) Client crash on /endgame

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#14305) Client crash on /endgame
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 5 Dec 2005 19:50:13 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=14305 >

I think it's not safe to remove the assertions at the client: if a
freeze/thaw isn't done correctly, I believe it can be a fatal error
because stuff happens when the game data is in an inconsistent
state...and this will be much harder to debug.  The freeze/thaw is
really ugly but I don't know how to make it better.

Your second patch is fine and should fix the problem.  This patch is
slightly cleaner and may be more (or less) safe.  I really don't know
this code well enough to say for sure.

-jason

Index: server/srv_main.c
===================================================================
--- server/srv_main.c   (revision 11308)
+++ server/srv_main.c   (working copy)
@@ -1576,6 +1576,7 @@
    */
   lsend_packet_freeze_hint(game.est_connections);
 
+  assert(server_state == RUN_GAME_STATE);
   while(server_state==RUN_GAME_STATE) {
     /* The beginning of a turn.
      *
@@ -1624,7 +1625,8 @@
       clear_timer_start(eot_timer);
 
       if (server_state == GAME_OVER_STATE) {
-       break;
+       free_timer(eot_timer);
+       return;
       }
 
       conn_list_do_buffer(game.est_connections);
@@ -1640,9 +1642,6 @@
 
       conn_list_do_unbuffer(game.est_connections);
     }
-    if (server_state == GAME_OVER_STATE) {
-      break;
-    }
     end_turn();
     freelog(LOG_DEBUG, "Sendinfotometaserver");
     (void) send_server_info_to_metaserver(META_REFRESH);
@@ -1652,12 +1651,7 @@
     }
   }
 
-  /* 
-   * This will thaw the reports and agents at the client.
-   */
-  lsend_packet_thaw_hint(game.est_connections);
-
-  free_timer(eot_timer);
+  assert(0); /* not reached */
 }
 
 /**************************************************************************

[Prev in Thread] Current Thread [Next in Thread]