Changeset - r188:cfcdd8e025f3
[Not reviewed]
master
0 3 0
darkvater - 20 years ago 2004-09-09 16:20:33
darkvater@openttd.org
(svn r189) -Fix: [1024750] Fix: network.c - timeout error. When one client timed out, all clients were disconnected (sign_de)
3 files changed with 11 insertions and 7 deletions:
0 comments (0 inline, 0 general)
network.c
Show inline comments
 
@@ -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();
 
		}
 

	
settings.c
Show inline comments
 
@@ -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}
 
};
 

	
variables.h
Show inline comments
 
@@ -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;
 

	
0 comments (0 inline, 0 general)