Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2005:
[Freeciv-Dev] Re: (PR#11852) pubserver crash in kill_player
Home

[Freeciv-Dev] Re: (PR#11852) pubserver crash in kill_player

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#11852) pubserver crash in kill_player
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sat, 8 Jan 2005 06:21:27 -0800
Reply-to: bugs@xxxxxxxxxxx

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

This patch seems to be sufficient. Although the gdb backtraces do seem to
indicate there are other problems, these may be illusory. I can no longer
reproduce the bug with this patch, in any case.

The problem lies in us trying to send data to connections that are not
connected to any player.

Vasco, Mike - please have a look.

  - Per

Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.330.2.16
diff -u -r1.330.2.16 plrhand.c
--- server/plrhand.c    1 Jan 2005 22:12:45 -0000       1.330.2.16
+++ server/plrhand.c    8 Jan 2005 14:15:58 -0000
@@ -1425,15 +1425,14 @@
       package_player_common(pplayer, &info);
 
       conn_list_iterate(*dest, pconn) {
-       if (!pconn->player && pconn->observer) {
-         /* Observer for all players. */
-         package_player_info(pplayer, &info, NULL, INFO_FULL);
-       } else if (!pconn->player) {
-         /* Client not yet attached to player. */
-         package_player_info(pplayer, &info, NULL, INFO_MINIMUM);
-       } else {
+       if (pconn->player && pconn->player->is_observer) {
+         /* Observer player. */
+         package_player_info(pplayer, &info, pconn->player, INFO_FULL);
+       } else if (pconn->player) {
          /* Player clients (including one player observers) */
          package_player_info(pplayer, &info, pconn->player, INFO_MINIMUM);
+       } else {
+         /* Client not yet attached to player? You get nothing. */
        }
 
         send_packet_player_info(pconn, &info);

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