static double nextheartbeattime = 0;
sizebuf_t net_message;
+static qbyte net_message_buf[NET_MAXMESSAGE];
cvar_t net_messagetimeout = {0, "net_messagetimeout","300"};
cvar_t net_messagerejointimeout = {0, "net_messagerejointimeout","10"};
}
static qboolean _ServerList_CompareStr( const char *A, serverlist_maskop_t op, const char *B )
-{
+{
// Same here, also using an intermediate & final return would be more appropriate
// A info B mask
switch( op ) {
cls.demonum = -1; // not in the demo loop now
cls.state = ca_connected;
cls.signon = 0; // need all the signon messages before playing
- CL_ClearState();
}
int NetConn_IsLocalGame(void)
{
int n;
- serverquerycount++;
-
dpsnprintf (ipstring, sizeof (ipstring), "%u.%u.%u.%u:%u", data[1], data[2], data[3], data[4], (data[5] << 8) | data[6]);
if (developer.integer)
Con_Printf("Requesting info from server %s\n", ipstring);
if( serverlist_cachecount == SERVERLIST_TOTALSIZE )
break;
// also ignore it if we have already queried it (other master server response)
- for( n = 0 ; n < serverlist_cachecount ; n++ )
+ for( n = 0 ; n < serverlist_cachecount ; n++ )
if( !strcmp( ipstring, serverlist_cache[ n ].info.cname ) )
break;
- if( n < serverlist_cachecount )
- break;
+ if( n >= serverlist_cachecount )
+ {
+ serverquerycount++;
- LHNETADDRESS_FromString(&svaddress, ipstring, 0);
- NetConn_WriteString(mysocket, "\377\377\377\377getinfo", &svaddress);
+ LHNETADDRESS_FromString(&svaddress, ipstring, 0);
+ NetConn_WriteString(mysocket, "\377\377\377\377getinfo", &svaddress);
- memset(&serverlist_cache[serverlist_cachecount], 0, sizeof(serverlist_cache[serverlist_cachecount]));
- // store the data the engine cares about (address and ping)
- strlcpy (serverlist_cache[serverlist_cachecount].info.cname, ipstring, sizeof (serverlist_cache[serverlist_cachecount].info.cname));
- serverlist_cache[serverlist_cachecount].info.ping = 100000;
- serverlist_cache[serverlist_cachecount].querytime = realtime;
- // if not in the slist menu we should print the server to console
- if (serverlist_consoleoutput)
- Con_Printf("querying %s\n", ipstring);
+ memset(&serverlist_cache[serverlist_cachecount], 0, sizeof(serverlist_cache[serverlist_cachecount]));
+ // store the data the engine cares about (address and ping)
+ strlcpy (serverlist_cache[serverlist_cachecount].info.cname, ipstring, sizeof (serverlist_cache[serverlist_cachecount].info.cname));
+ serverlist_cache[serverlist_cachecount].info.ping = 100000;
+ serverlist_cache[serverlist_cachecount].querytime = realtime;
+ // if not in the slist menu we should print the server to console
+ if (serverlist_consoleoutput)
+ Con_Printf("querying %s\n", ipstring);
- ++serverlist_cachecount;
+ ++serverlist_cachecount;
+ }
// move on to next address in packet
data += 7;
{
int i;
lhnetaddress_t tempaddress;
- netconn_mempool = Mem_AllocPool("Networking", 0, NULL);
+ netconn_mempool = Mem_AllocPool("network connections", 0, NULL);
Cmd_AddCommand("net_stats", Net_Stats_f);
Cmd_AddCommand("net_slist", Net_Slist_f);
Cmd_AddCommand("heartbeat", Net_Heartbeat_f);
}
cl_numsockets = 0;
sv_numsockets = 0;
- SZ_Alloc(&net_message, NET_MAXMESSAGE, "net_message");
+ net_message.data = net_message_buf;
+ net_message.maxsize = sizeof(net_message_buf);
+ net_message.cursize = 0;
LHNET_Init();
}