about summary refs log tree commit diff
path: root/src/engine/client
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/client')
-rw-r--r--src/engine/client/ec_client.c33
-rw-r--r--src/engine/client/ec_srvbrowse.c20
2 files changed, 45 insertions, 8 deletions
diff --git a/src/engine/client/ec_client.c b/src/engine/client/ec_client.c
index 9c63f7cb..f93cb5e5 100644
--- a/src/engine/client/ec_client.c
+++ b/src/engine/client/ec_client.c
@@ -1098,12 +1098,36 @@ static void client_update()
 	}
 
 	/* STRESS TEST: join the server again */
-	if(client_state() == CLIENTSTATE_OFFLINE && config.dbg_stress && (frames%100) == 0)
-		client_connect(config.dbg_stress_server);
+	if(config.dbg_stress)
+	{
+		static int64 action_taken = 0;
+		int64 now = time_get();
+		if(client_state() == CLIENTSTATE_OFFLINE)
+		{
+			if(now > action_taken+time_freq()*2)
+			{
+				dbg_msg("stress", "reconnecting!");
+				client_connect(config.dbg_stress_server);
+				action_taken = now;
+			}
+		}
+		else
+		{
+			if(now > action_taken+time_freq()*(10+config.dbg_stress))
+			{
+				dbg_msg("stress", "disconnecting!");
+				client_disconnect();
+				action_taken = now;
+			}
+		}
+	}
 	
 	/* pump the network */
 	client_pump_network();
 	
+	/* update the maser server registry */
+	mastersrv_update();
+	
 	/* update the server browser */
 	client_serverbrowse_update();
 }
@@ -1128,12 +1152,15 @@ static void client_run()
 	if(!gfx_init())
 		return;
 
+	/* start refreshing addresses while we load */
+	mastersrv_refresh_addresses();
+	
 	/* init the editor */
 	editor_init();
 
 	/* sound is allowed to fail */
 	snd_init();
-	
+
 	/* load data */
 	if(!client_load_data())
 		return;
diff --git a/src/engine/client/ec_srvbrowse.c b/src/engine/client/ec_srvbrowse.c
index 74d09b8d..0a6ebbf8 100644
--- a/src/engine/client/ec_srvbrowse.c
+++ b/src/engine/client/ec_srvbrowse.c
@@ -4,6 +4,7 @@
 #include <engine/e_client_interface.h>
 #include <engine/e_config.h>
 #include <engine/e_memheap.h>
+#include <engine/e_engine.h>
 
 #include <mastersrv/mastersrv.h>
 
@@ -341,18 +342,27 @@ void client_serverbrowse_refresh(int lan)
 	}
 	else
 	{
-		NETADDR4 master_server;
+		NETADDR4 addr;
 		NETPACKET p;
-
-		net_host_lookup(config.masterserver, MASTERSERVER_PORT, &master_server);
+		int i;
+		
+		/*net_host_lookup(config.masterserver, MASTERSERVER_PORT, &master_server);*/
 
 		mem_zero(&p, sizeof(p));
 		p.client_id = -1;
-		p.address = master_server;
 		p.flags = PACKETFLAG_CONNLESS;
 		p.data_size = sizeof(SERVERBROWSE_GETLIST);
 		p.data = SERVERBROWSE_GETLIST;
-		netclient_send(net, &p);	
+		
+		for(i = 0; i < MAX_MASTERSERVERS; i++)
+		{
+			addr = mastersrv_get(i);
+			if(!addr.ip[0] && !addr.ip[1] && !addr.ip[2] && !addr.ip[3])
+				continue;
+			
+			p.address = addr;
+			netclient_send(net, &p);	
+		}
 
 		if(config.debug)
 			dbg_msg("client", "requesting server list");