From cd3c8b8d72aff08a559f529aa1e803f453a03377 Mon Sep 17 00:00:00 2001 From: stpohle Date: Sat, 19 Aug 2006 23:07:12 +0000 Subject: [PATCH] infinite loop on slow network by player selection screen --- ChangeLog | 11 ++++++++++- TODO | 8 ++++++-- src/network.c | 4 ++-- src/packets.c | 14 +++++++++----- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 520a2a0..cd61496 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,13 @@ -$Id: ChangeLog,v 1.111 2006/08/15 15:49:18 stpohle Exp $ +$Id: ChangeLog,v 1.112 2006/08/19 23:07:12 stpohle Exp $ + +Work on: Second Player Problem + +- Fixed: problem on slow networks with the loop that the selected player + gfx gots selected and deselected. (infinite loop on the network) + +- Fixed: problem with overwriting the servers address on clients. + problem only seen on server who gets connected from two differen ip + addresses. Version 0.11.7 ============== diff --git a/TODO b/TODO index 3761f86..2d99b7d 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,8 @@ -$Id: TODO,v 1.43 2004/09/12 20:54:24 stpohle Exp $ +$Id: TODO,v 1.44 2006/08/19 23:07:12 stpohle Exp $ +- addr from server will be overwritten if the address is a different then the known one.. + do_playerid (never overwrite servers addr) -EMPTY FILE... +- kicking bombs.. maybe bombs will have to get floated points.. to make this better. + +- explosions.. sometimes bombs can explode more times, slow networks (very slow) diff --git a/src/network.c b/src/network.c index 71c7ba8..76969f1 100644 --- a/src/network.c +++ b/src/network.c @@ -1,4 +1,4 @@ -/* $Id: network.c,v 1.77 2006/08/13 21:26:50 stpohle Exp $ */ +/* $Id: network.c,v 1.78 2006/08/19 23:07:13 stpohle Exp $ */ /* network routines. */ @@ -132,7 +132,7 @@ network_init () bman.notifygamemaster = 0; } - // we have got our socket.. so now allocate the memory for the resend_cache + // we have got our socket.. rscache_init (); return 0; diff --git a/src/packets.c b/src/packets.c index c1908c2..61bedf2 100644 --- a/src/packets.c +++ b/src/packets.c @@ -344,7 +344,7 @@ do_playerid (struct pkg_playerid *p_id, _net_addr * addr) pl->net.pingreq = pl->net.pingack + 5; if (GT_MP_PTPS) pl->net.flags = p_id->netflags; - if (p_id->host[0] != 0) { + if (p_id->host[0] != 0 && p_id->pl_nr != bman.p_servnr) { // copy addr only if p_id != server pl->net.addr.pl_nr = addr->pl_nr; strncpy (pl->net.addr.host, p_id->host, LEN_SERVERNAME); strncpy (pl->net.addr.port, p_id->port, LEN_PORT); @@ -353,7 +353,7 @@ do_playerid (struct pkg_playerid *p_id, _net_addr * addr) } /* player is used, we need to check if it's the second player from the server * to set it's host and port name */ - else if (PS_IS_used (p_id->state)) { + else if (PS_IS_used (p_id->state) && p_id->pl_nr != bman.p_servnr) { // copy addr only if p_id != server strncpy (pl->net.addr.host, players[bman.p_servnr].net.addr.host, LEN_SERVERNAME); strncpy (pl->net.addr.port, players[bman.p_servnr].net.addr.port, LEN_PORT); memcpy (&pl->net.addr.sAddr, &players[bman.p_servnr].net.addr.sAddr, @@ -361,7 +361,7 @@ do_playerid (struct pkg_playerid *p_id, _net_addr * addr) } /* Check if we have to make a network test.. only client to client - * we won't check 2 players too because i't won't be possible to send + * we won't check 2 players too because it won't be possible to send * something to them. * * Check only as long as pl->state is still not a network player */ @@ -386,8 +386,12 @@ do_playerid (struct pkg_playerid *p_id, _net_addr * addr) else pl->state &= (0xff - PSF_net); - if (pl->gfx_nr != p_id->gfx_nr) - player_set_gfx (pl, p_id->gfx_nr); + /* make sure we won't end up in an infinite loop, because of a slow network. + * only accept the gfx data from other players. Our own we will not overwrite.*/ + if ((bman.state != GS_wait + || (p_id->pl_nr != bman.p_nr && p_id->pl_nr != bman.p2_nr)) + && pl->gfx_nr != p_id->gfx_nr) + player_set_gfx (pl, p_id->gfx_nr); strncpy (pl->name, p_id->name, LEN_PLAYERNAME); if (GT_MP_PTPS) {