diff options
author | darkvater <darkvater@openttd.org> | 2004-09-09 16:20:33 +0000 |
---|---|---|
committer | darkvater <darkvater@openttd.org> | 2004-09-09 16:20:33 +0000 |
commit | 216abe4e93bae5c02fb613fe148a8ac6252cf82f (patch) | |
tree | 875aafd644b28b0ba158dd2c47181311d78db95a | |
parent | 5ecaebcc6c72ecfd476e587b4d9723dc7fa06be0 (diff) | |
download | openttd-216abe4e93bae5c02fb613fe148a8ac6252cf82f.tar.xz |
(svn r189) -Fix: [1024750] Fix: network.c - timeout error. When one client timed out, all clients were disconnected (sign_de)
-rw-r--r-- | network.c | 10 | ||||
-rw-r--r-- | settings.c | 4 | ||||
-rw-r--r-- | variables.h | 4 |
3 files changed, 11 insertions, 7 deletions
@@ -1096,6 +1096,7 @@ void NetworkSend() SyncPacket sp; uint new_max; + _network_ahead_frames = _network_sync_freq + 1; ready_all=false; @@ -1106,7 +1107,7 @@ void NetworkSend() for(cs=_clients;cs->socket != INVALID_SOCKET; cs++) { count++; ready_all = ready_all && (cs->ready || cs->inactive || (cs->xmitpos>0)); - cs->timeout-=5; + if (!cs->ready) cs->timeout-=5; if (cs->timeout == 0) { SET_DPARAM16(0,count); ShowErrorMessage(-1,STR_NETWORK_ERR_TIMEOUT,0,0); @@ -1122,7 +1123,9 @@ void NetworkSend() _not_packet = 0; new_max = max(_frame_counter + (int)_network_ahead_frames, _frame_counter_max); - + + DEBUG(net,3) ("net: serv: sync max=%i, seed1=%i, seed2=%i",new_max,_sync_seed_1,_sync_seed_2); + sp.packet_length = sizeof(sp); sp.packet_type = 1; sp.frames = new_max - _frame_counter_max; @@ -1511,6 +1514,7 @@ if (_network_available) { IConsoleCmdRegister("connect",NetworkConsoleCmdConnect); IConsoleVarRegister("net_client_timeout",&_network_client_timeout,ICONSOLE_VAR_UINT16); IConsoleVarRegister("net_ready_ahead",&_network_ready_ahead,ICONSOLE_VAR_UINT16); + IConsoleVarRegister("net_sync_freq",&_network_sync_freq,ICONSOLE_VAR_UINT16); } else { DEBUG(net, 3) ("[NET][Core] FAILED: multiplayer not available"); } @@ -1636,7 +1640,7 @@ if (incomming) { if ((_networking) && (!_networking_server) && (_frame_counter+_network_ready_ahead >= _frame_counter_max)) { // send the "i" am ready message to the server - // [_network_ready_ahead] frame before "i" reach the frame-limit + // [_network_ready_ahead] frames before "i" reach the frame-limit NetworkSendReadyPacket(); } diff --git a/settings.c b/settings.c index 44bf4d36d..84eecc1a2 100644 --- a/settings.c +++ b/settings.c @@ -762,8 +762,8 @@ static const SettingDesc misc_settings[] = { static const SettingDesc network_settings[] = { {"port", SDT_UINT | SDT_NOSAVE, (void*)3978, &_network_client_port, NULL}, {"server_port", SDT_UINT | SDT_NOSAVE, (void*)3979, &_network_server_port, NULL}, - {"sync_freq", SDT_UINT | SDT_NOSAVE, (void*)4, &_network_sync_freq, NULL}, - {"ahead_frames", SDT_UINT | SDT_NOSAVE, (void*)5, &_network_ahead_frames, NULL}, + {"sync_freq", SDT_UINT16 | SDT_NOSAVE, (void*)4, &_network_sync_freq, NULL}, + {"ahead_frames", SDT_UINT16 | SDT_NOSAVE, (void*)5, &_network_ahead_frames, NULL}, {NULL, 0, NULL, NULL, NULL} }; diff --git a/variables.h b/variables.h index f34571460..f3ef039d7 100644 --- a/variables.h +++ b/variables.h @@ -227,8 +227,8 @@ VARDEF uint16 _network_game_count; VARDEF uint _network_client_port; VARDEF uint _network_server_port; -VARDEF uint _network_sync_freq; -VARDEF uint _network_ahead_frames; +VARDEF uint16 _network_sync_freq; +VARDEF uint16 _network_ahead_frames; VARDEF uint32 _sync_seed_1, _sync_seed_2; |