URL: http://bugs.freeciv.org/Ticket/Display.html?id=39613
[pepeto - Sat Aug 25 15:15:14 2007]:
When a user which is detached loses connection or leaves, the
client is not informed of it. The connection is still in the
visible connection list. I fixed this bug a long time ago for
warserver by a hack. You should resolve this by a good code.
I added in sernet.c:
void close_connection(struct connection *pconn)
{
[...]
+ send_conn_info(pconn-self, game.est_connections);
}
to be sure the connection will be removed in the client list.
(send_conn_info(pconn-self, game.est_connections); in 2.0)
This does work, but I think the possible recursion between
the high-level send_conn_info and low-level close_connection
could cause weird problems in special circumstances. :S
Anyway, it would seem to me that this problem is just caused
by a mistake in lost_connection_to_client; it was not updated
when it became necessary to send connection info when a
connection was lost (e.g. for the client's pregame list).
The attached patches for S2_1 and trunk move some stuff around
in that function and appear to fix the problem.
---
光の速度で走って
diff --git a/server/connecthand.c b/server/connecthand.c
index 94ce9d5..910a096 100644
--- a/server/connecthand.c
+++ b/server/connecthand.c
@@ -343,15 +343,15 @@ void lost_connection_to_client(struct connection *pconn)
notify_conn(game.est_connections, NULL, E_CONNECTION,
_(Lost connection: %s.), desc);
+ unattach_connection_from_player(pconn);
+ send_conn_info_remove(pconn-self, game.est_connections);
+ notify_if_first_access_level_is_available();
+
if (!pplayer) {
delayed_disconnect--;
return;
}
- unattach_connection_from_player(pconn);
- send_conn_info_remove(pconn-self, game.est_connections);
- notify_if_first_access_level_is_available();
-
if (game.info.is_new_game
!pplayer-is_connected /* eg multiple controllers */
!pplayer-ai.control/* eg created AI player */
diff --git a/server/connecthand.c b/server/connecthand.c
index 13d1407..f2630ca 100644
--- a/server/connecthand.c
+++ b/server/connecthand.c
@@ -330,15 +330,15 @@ void lost_connection_to_client(struct connection *pconn)
notify_conn(game.est_connections, NULL, E_CONNECTION,
_(Lost connection: %s.), desc);
+ detach_connection_to_player(pconn, FALSE);
+ send_conn_info_remove(pconn-self, game.est_connections);
+ notify_if_first_access_level_is_available();
+
if (!pplayer) {
delayed_disconnect--;
return;
}
- detach_connection_to_player(pconn, FALSE);
- send_conn_info_remove(pconn-self, game.est_connections);
- notify_if_first_access_level_is_available();
-
if (game.info.is_new_game
!pplayer-is_connected /* eg multiple controllers */
!pplayer-ai.control/* eg created AI player */
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev