infinite loop on slow network by player selection screen

origin
stpohle 19 years ago
parent de540ae50b
commit cd3c8b8d72

@ -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 Version 0.11.7
============== ==============

@ -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)

@ -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. network routines.
*/ */
@ -132,7 +132,7 @@ network_init ()
bman.notifygamemaster = 0; bman.notifygamemaster = 0;
} }
// we have got our socket.. so now allocate the memory for the resend_cache // we have got our socket..
rscache_init (); rscache_init ();
return 0; return 0;

@ -344,7 +344,7 @@ do_playerid (struct pkg_playerid *p_id, _net_addr * addr)
pl->net.pingreq = pl->net.pingack + 5; pl->net.pingreq = pl->net.pingack + 5;
if (GT_MP_PTPS) if (GT_MP_PTPS)
pl->net.flags = p_id->netflags; 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; pl->net.addr.pl_nr = addr->pl_nr;
strncpy (pl->net.addr.host, p_id->host, LEN_SERVERNAME); strncpy (pl->net.addr.host, p_id->host, LEN_SERVERNAME);
strncpy (pl->net.addr.port, p_id->port, LEN_PORT); 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 /* player is used, we need to check if it's the second player from the server
* to set it's host and port name */ * 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.host, players[bman.p_servnr].net.addr.host, LEN_SERVERNAME);
strncpy (pl->net.addr.port, players[bman.p_servnr].net.addr.port, LEN_PORT); 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, 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 /* 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. * something to them.
* *
* Check only as long as pl->state is still not a network player */ * Check only as long as pl->state is still not a network player */
@ -386,7 +386,11 @@ do_playerid (struct pkg_playerid *p_id, _net_addr * addr)
else else
pl->state &= (0xff - PSF_net); pl->state &= (0xff - PSF_net);
if (pl->gfx_nr != 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); player_set_gfx (pl, p_id->gfx_nr);
strncpy (pl->name, p_id->name, LEN_PLAYERNAME); strncpy (pl->name, p_id->name, LEN_PLAYERNAME);

Loading…
Cancel
Save