From 548a919ea379a3b9d1d9e41cf4dad6b4779fd3e6 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Sun, 10 Feb 2008 21:54:52 +0000 Subject: merged 0.3.4 changes to trunk --- src/engine/client/ec_client.c | 33 ++++++++++++++++++++++++++++++--- src/engine/client/ec_srvbrowse.c | 20 +++++++++++++++----- 2 files changed, 45 insertions(+), 8 deletions(-) (limited to 'src/engine/client') 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 #include #include +#include #include @@ -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"); -- cgit 1.4.1