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

[Freeciv-Dev] Re: (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] Re: (PR#14305) Client crash on /endgame
From: "Mike Kaufman" <kaufman@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 3 Dec 2005 16:00:58 -0800
Reply-to: bugs@xxxxxxxxxxx

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

this is a result of revision 10857. Specifically:

@@ -1635,6 +1638,9 @@
 
       conn_list_do_unbuffer(game.game_connections);
     }
+    if (server_state == GAME_OVER_STATE) {
+      break;
+    }
     end_turn();
     freelog(LOG_DEBUG, "Sendinfotometaserver");
     (void) send_server_info_to_metaserver(META_REFRESH);

in srv_main.c which results in two lsend_packet_thaw_hint()s being sent to
the client without a lsend_packet_freeze_hint() in between.

In my opinion, the frozen_level asserts in the client are overzealous for
just this reason: a "bug" in the server will cause the client to die. These
are supposed to be _hints_ after all. Attached is a patch which removes the
asserts.

That said, here's also a patch which fixes the extra thaw in the server.
Probably a better way to do it though...

-mike

Index: client/agents/agents.c
===================================================================
--- client/agents/agents.c      (revision 11298)
+++ client/agents/agents.c      (working copy)
@@ -276,7 +276,11 @@
     freelog(LOG_NORMAL, "A: thaw() current level=%d", frozen_level);
   }
   frozen_level--;
-  assert(frozen_level >= 0);
+
+  if (frozen_level < 0 ) {
+    frozen_level = 0;
+  }
+
   if (frozen_level == 0 && get_client_state() == CLIENT_GAME_RUNNING_STATE) {
     call_handle_methods();
   }
Index: client/repodlgs_common.c
===================================================================
--- client/repodlgs_common.c    (revision 11298)
+++ client/repodlgs_common.c    (working copy)
@@ -162,7 +162,11 @@
 void report_dialogs_thaw(void)
 {
   frozen_level--;
-  assert(frozen_level >= 0);
+
+  if (frozen_level < 0 ) {
+    frozen_level = 0;
+  }
+
   if (frozen_level == 0) {
     update_report_dialogs();
   }
Index: client/plrdlg_common.c
===================================================================
--- client/plrdlg_common.c      (revision 11298)
+++ client/plrdlg_common.c      (working copy)
@@ -45,7 +45,11 @@
 void plrdlg_thaw(void)
 {
   frozen_level--;
-  assert(frozen_level >= 0);
+
+  if (frozen_level < 0 ) {
+    frozen_level = 0;
+  }
+
   if (frozen_level == 0) {
     update_players_dialog();
   }
Index: client/messagewin_common.c
===================================================================
--- client/messagewin_common.c  (revision 11298)
+++ client/messagewin_common.c  (working copy)
@@ -51,7 +51,11 @@
 void meswin_thaw(void)
 {
   frozen_level--;
-  assert(frozen_level >= 0);
+
+  if (frozen_level < 0 ) {
+    frozen_level = 0;
+  }
+
   if (frozen_level == 0) {
     update_meswin_dialog();
   }
Index: client/chatline_common.c
===================================================================
--- client/chatline_common.c    (revision 11298)
+++ client/chatline_common.c    (working copy)
@@ -87,8 +87,11 @@
 void output_window_thaw()
 {
   frozen_level--;
-  assert(frozen_level >= 0);
 
+  if (frozen_level < 0 ) {
+    frozen_level = 0;
+  }
+
   if (frozen_level == 0) {
     remaining_list_iterate(remains, pline) {
       append_output_window_full(pline->text, pline->conn_id);
Index: server/srv_main.c
===================================================================
--- server/srv_main.c   (revision 11298)
+++ server/srv_main.c   (working copy)
@@ -1624,7 +1624,8 @@
       clear_timer_start(eot_timer);
 
       if (server_state == GAME_OVER_STATE) {
-       break;
+        lsend_packet_freeze_hint(game.est_connections);
+        break;
       }
 
       conn_list_do_buffer(game.est_connections);

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