Re: [Freeciv-Dev] (PR#39627) [Bug] assert fail when taking player
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39627 2007/8/30 Marko Lindqvist cazf...@gmail.com: On 30/08/2007, Pepeto _ pepet...@hotmail.fr wrote: On 29/08/07, Michael Kaufman kauf...@physics.wisc.edu wrote: The last time I checked, not doing a client reset on player switch caused bad things to happen, but I can't be more specific than that. there should be a game_free() game_init() Problem with game_free() + game_init() are is-info packets. Delta code needs changes so that we can force sending those packets again. Delta code is already updated. Attached patch makes game_free() + game_init() reset at client side and server side is forced to send tile info packets after that. Even though protocol doesn't change, new client will fail to work with old server (as it makes the reset, but server will not serve tile infos again) so I bumped capability string. - ML diff -Nurd -X.diff_ignore freeciv/client/packhand.c freeciv/client/packhand.c --- freeciv/client/packhand.c 2009-05-03 18:59:38.0 +0300 +++ freeciv/client/packhand.c 2009-05-04 14:52:00.0 +0300 @@ -2492,9 +2492,9 @@ * the nation selection dialog if it is open. */ popdown_races_dialog(); - ruleset_data_free(); - + game_free(); ruleset_cache_init(); + game_init(); game.control = *packet; diff -Nurd -X.diff_ignore freeciv/common/effects.c freeciv/common/effects.c --- freeciv/common/effects.c 2009-04-29 20:40:43.0 +0300 +++ freeciv/common/effects.c 2009-05-04 14:52:36.0 +0300 @@ -338,7 +338,7 @@ } /** - Initialize the ruleset cache. The ruleset cache should be emtpy + Initialize the ruleset cache. The ruleset cache should be empty before this is done (so if it's previously been initialized, it needs to be freed (see ruleset_cache_free) before it can be reused). **/ diff -Nurd -X.diff_ignore freeciv/server/citytools.c freeciv/server/citytools.c --- freeciv/server/citytools.c 2009-03-19 18:05:44.0 +0200 +++ freeciv/server/citytools.c 2009-05-04 14:36:41.0 +0300 @@ -2126,7 +2126,7 @@ int city_x, int city_y) { tile_set_worked(ptile, NULL); - send_tile_info(NULL, ptile, FALSE); + send_tile_info(NULL, ptile, FALSE, FALSE); pcity-city_map[city_x][city_y] = C_TILE_EMPTY; pcity-server.synced = FALSE; } @@ -2140,7 +2140,7 @@ int city_x, int city_y) { tile_set_worked(ptile, pcity); - send_tile_info(NULL, ptile, FALSE); + send_tile_info(NULL, ptile, FALSE, FALSE); pcity-city_map[city_x][city_y] = C_TILE_WORKER; pcity-server.synced = FALSE; } @@ -2158,7 +2158,7 @@ !is_free_worked(pwork, ptile) !city_can_work_tile(pwork, ptile)) { tile_set_worked(ptile, NULL); -send_tile_info(NULL, ptile, FALSE); +send_tile_info(NULL, ptile, FALSE, FALSE); pwork-specialists[DEFAULT_SPECIALIST]++; /* keep city sanity */ pwork-server.synced = FALSE; diff -Nurd -X.diff_ignore freeciv/server/connecthand.c freeciv/server/connecthand.c --- freeciv/server/connecthand.c 2008-12-15 21:55:50.0 +0200 +++ freeciv/server/connecthand.c 2009-05-04 14:37:20.0 +0300 @@ -120,7 +120,7 @@ /* Player and other info is only updated when the game is running. * See the comment in lost_connection_to_client(). */ send_packet_freeze_hint(pconn); - send_all_info(dest); + send_all_info(dest, TRUE); send_diplomatic_meetings(pconn); send_packet_thaw_hint(pconn); dsend_packet_start_phase(pconn, game.info.phase); diff -Nurd -X.diff_ignore freeciv/server/edithand.c freeciv/server/edithand.c --- freeciv/server/edithand.c 2009-01-27 12:17:08.0 +0200 +++ freeciv/server/edithand.c 2009-05-04 14:38:31.0 +0300 @@ -104,7 +104,7 @@ hash_delete_all_entries(unfixed_tile_table); assign_continent_numbers(); - send_all_known_tiles(NULL); + send_all_known_tiles(NULL, FALSE); } / @@ -377,7 +377,7 @@ /* Send the new state to all affected. */ if (changed) { update_tile_knowledge(ptile); -send_tile_info(NULL, ptile, FALSE); +send_tile_info(NULL, ptile, FALSE, FALSE); } } @@ -1132,7 +1132,7 @@ map_clear_known(ptile, pplayer); } -send_tile_info(NULL, ptile, TRUE); +send_tile_info(NULL, ptile, TRUE, FALSE); } square_iterate_end; conn_list_do_unbuffer(game.est_connections); } @@ -1230,7 +1230,7 @@ map_set_startpos(ptile, pnation); if (old != pnation) { -send_tile_info(NULL, ptile, FALSE); +send_tile_info(NULL, ptile, FALSE, FALSE); } } diff -Nurd -X.diff_ignore freeciv/server/maphand.c freeciv/server/maphand.c --- freeciv/server/maphand.c 2009-03-08 13:54:37.0 +0200 +++ freeciv/server/maphand.c 2009-05-04 14:44:49.0 +0300 @@ -294,7 +294,7 @@
[Freeciv-Dev] (PR#39627) [Bug] assert fail when taking player
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39627 [EMAIL PROTECTED] - Mar. Aoû. 28 22:55:36 2007]: On 29/08/07, Michael Kaufman [EMAIL PROTECTED] wrote: The last time I checked, not doing a client reset on player switch caused bad things to happen, but I can't be more specific than that. Then S2_1 solution would probably be to make even more complete reset, setting also player-nation to NULL for all players. Actually, player-nation reset should be added to handle_ruleset_control() in any case for player-nation-player consistency. - ML This would just make the problem in a other place... I think Michael Kaufman is right, there should be a game_free() game_init() when the player quits a server. Maybe a right place for it: set_client_state() when the new state will be CLIENT_PRE_GAME_STATE. The same if the old state is already CLIENT_PRE_GAME_STATE. ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39627) [Bug] assert fail when taking player
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39627 On 29/08/2007, Marko Lindqvist [EMAIL PROTECTED] wrote: On 29/08/07, Michael Kaufman [EMAIL PROTECTED] wrote: The last time I checked, not doing a client reset on player switch caused bad things to happen, but I can't be more specific than that. Then S2_1 solution would probably be to make even more complete reset, setting also player-nation to NULL for all players. Actually, player-nation reset should be added to handle_ruleset_control() in any case for player-nation-player consistency. This patch adds player-nation reset after nation-player has been reseted in handle_ruleset_control(). This should fix several client end player-nation-player inconsistency crashes, and it helps against crash in this ticket too. - ML diff -Nurd -X.diff_ignore freeciv/client/packhand.c freeciv/client/packhand.c --- freeciv/client/packhand.c 2007-08-21 21:41:47.0 +0300 +++ freeciv/client/packhand.c 2007-08-30 22:39:28.0 +0300 @@ -2118,6 +2118,12 @@ nations_alloc(packet-nation_count); city_styles_alloc(packet-styles_count); + /* After nation ruleset free/alloc, nation-player pointers are NULL. + * We have to initialize player-nation too, to keep state consistent. */ + players_iterate(pplayer) { +pplayer-nation = NO_NATION_SELECTED; + } players_iterate_end; + if (packet-prefered_tileset[0] != '\0') { /* There is tileset suggestion */ if (strcmp(packet-prefered_tileset, tileset_get_name(tileset))) { ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39627) [Bug] assert fail when taking player
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39627 On 30/08/2007, Pepeto _ [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] - Mar. Aoû. 28 22:55:36 2007]: On 29/08/07, Michael Kaufman [EMAIL PROTECTED] wrote: The last time I checked, not doing a client reset on player switch caused bad things to happen, but I can't be more specific than that. Then S2_1 solution would probably be to make even more complete reset, setting also player-nation to NULL for all players. Actually, player-nation reset should be added to handle_ruleset_control() in any case for player-nation-player consistency. there should be a game_free() game_init() I don't think other pointers than player-nation are used between ruleset_data_free() and receiving relevant packet again. Problem with game_free() + game_init() are is-info packets. Delta code needs changes so that we can force sending those packets again. - ML ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39627) [Bug] assert fail when taking player
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39627 On Tue, Aug 28, 2007 at 02:34:02PM -0700, Marko Lindqvist wrote: Patch attached. I'm not aware of any problems caused by not sending ruleset data when /take command is issued, but it doesn't mean there is none... (Remember that in order to /take client already has to be connected to current game and it has received identical rulesets) not off the top of my head, but the dependencies of switching players in the client are [or were] hellish, so the less than ideal solution was a game_free() inside the client to reset it properly, thus requiring the client to need rulesets again. The last time I checked, not doing a client reset on player switch caused bad things to happen, but I can't be more specific than that. M ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev