int serverlist_sortflags;
int serverlist_viewcount = 0;
-serverlist_entry_t *serverlist_viewlist[SERVERLIST_VIEWLISTSIZE];
+unsigned short serverlist_viewlist[SERVERLIST_VIEWLISTSIZE];
int serverlist_maxcachecount = 0;
int serverlist_cachecount = 0;
for( ; i > index ; i-- )
serverlist_viewlist[ i ] = serverlist_viewlist[ i - 1 ];
- serverlist_viewlist[index] = entry;
+ serverlist_viewlist[index] = (int)(entry - serverlist_cache);
}
/// we suppose serverlist_viewcount to be valid, ie > 0
// two special cases
// check whether to insert it as new first item
- if( _ServerList_Entry_Compare( entry, serverlist_viewlist[0] ) ) {
+ if( _ServerList_Entry_Compare( entry, ServerList_GetViewEntry(0) ) ) {
_ServerList_ViewList_Helper_InsertBefore( 0, entry );
return;
} // check whether to insert it as new last item
- else if( !_ServerList_Entry_Compare( entry, serverlist_viewlist[serverlist_viewcount - 1] ) ) {
+ else if( !_ServerList_Entry_Compare( entry, ServerList_GetViewEntry(serverlist_viewcount - 1) ) ) {
_ServerList_ViewList_Helper_InsertBefore( serverlist_viewcount, entry );
return;
}
{
mid = (start + end) / 2;
// test the item that lies in the middle between start and end
- if( _ServerList_Entry_Compare( entry, serverlist_viewlist[mid] ) )
+ if( _ServerList_Entry_Compare( entry, ServerList_GetViewEntry(mid) ) )
// the item has to be in the upper half
end = mid;
else
int i;
for( i = 0; i < serverlist_viewcount; i++ )
{
- if (serverlist_viewlist[i] == entry)
+ if (ServerList_GetViewEntry(i) == entry)
{
_ServerList_ViewList_Helper_Remove(i);
break;
int sequence, sequence_ack;
int reliable_ack, reliable_message;
int count;
- int qport;
+ //int qport;
sequence = LittleLong(*((int *)(data + 0)));
sequence_ack = LittleLong(*((int *)(data + 4)));
if (length < 2)
return 0;
// TODO: use qport to identify that this client really is who they say they are? (and elsewhere in the code to identify the connection without a port match?)
- qport = LittleShort(*((int *)(data + 8)));
+ //qport = LittleShort(*((int *)(data + 8)));
data += 2;
length -= 2;
}
if (length > 10 && !memcmp(string, "challenge ", 10) && cls.rcon_trying)
{
- int i, j;
+ int i = 0, j;
for (j = 0;j < MAX_RCONS;j++)
{
+ // note: this value from i is used outside the loop too...
i = (cls.rcon_ringpos + j) % MAX_RCONS;
if(cls.rcon_commands[i][0])
if (!LHNETADDRESS_Compare(peeraddress, &cls.rcon_addresses[i]))
if(HMAC_MDFOUR_16BYTES((unsigned char *) (buf + 29), (unsigned char *) argbuf, strlen(argbuf), (unsigned char *) rcon_password.string, n))
{
+ int k;
buf[45] = ' ';
strlcpy(buf + 46, argbuf, sizeof(buf) - 46);
NetConn_Write(mysocket, buf, 46 + strlen(buf + 46), peeraddress);
cls.rcon_commands[i][0] = 0;
--cls.rcon_trying;
- for (i = 0;i < MAX_RCONS;i++)
- if(cls.rcon_commands[i][0])
- if (!LHNETADDRESS_Compare(peeraddress, &cls.rcon_addresses[i]))
+ for (k = 0;k < MAX_RCONS;k++)
+ if(cls.rcon_commands[k][0])
+ if (!LHNETADDRESS_Compare(peeraddress, &cls.rcon_addresses[k]))
break;
- if(i < MAX_RCONS)
+ if(k < MAX_RCONS)
{
+ int l;
NetConn_WriteString(mysocket, "\377\377\377\377getchallenge", peeraddress);
// extend the timeout on other requests as we asked for a challenge
- for (i = 0;i < MAX_RCONS;i++)
- if(cls.rcon_commands[i][0])
- if (!LHNETADDRESS_Compare(peeraddress, &cls.rcon_addresses[i]))
- cls.rcon_timeout[i] = realtime + rcon_secure_challengetimeout.value;
+ for (l = 0;l < MAX_RCONS;l++)
+ if(cls.rcon_commands[l][0])
+ if (!LHNETADDRESS_Compare(peeraddress, &cls.rcon_addresses[l]))
+ cls.rcon_timeout[l] = realtime + rcon_secure_challengetimeout.value;
}
return true; // we used up the challenge, so we can't use this oen for connecting now anyway
SZ_Clear(&net_message);
}
for (i = 0;i < cl_numsockets;i++)
+ {
while (cl_sockets[i] && (length = NetConn_Read(cl_sockets[i], readbuffer, sizeof(readbuffer), &peeraddress)) > 0)
+ {
+// R_TimeReport("clientreadnetwork");
NetConn_ClientParsePacket(cl_sockets[i], readbuffer, length, &peeraddress);
+// R_TimeReport("clientparsepacket");
+ }
+ }
NetConn_QueryQueueFrame();
if (cls.netcon && realtime > cls.netcon->timeout && !sv.active)
{
"%s",
fullstatus ? "statusResponse" : "infoResponse",
gamename, com_modname, gameversion.integer, svs.maxclients,
- nb_clients, nb_bots, sv.name, hostname.string, NET_PROTOCOL_VERSION,
+ nb_clients, nb_bots, sv.worldbasename, hostname.string, NET_PROTOCOL_VERSION,
*qcstatus ? "\\qcstatus\\" : "", qcstatus,
challenge ? "\\challenge\\" : "", challenge ? challenge : "",
fullstatus ? "\n" : "");
const char *RCon_Authenticate(lhnetaddress_t *peeraddress, const char *password, const char *s, const char *endpos, rcon_matchfunc_t comparator, const char *cs, int cslen)
{
const char *text, *userpass_start, *userpass_end, *userpass_startpass;
- char buf[MAX_INPUTLINE];
+ static char buf[MAX_INPUTLINE];
qboolean hasquotes;
qboolean restricted = false;
qboolean have_usernames = false;
userpass_startpass = strchr(userpass_start, ':');
if(have_usernames && userpass_startpass && userpass_startpass < userpass_end)
return va("%srcon (username %.*s)", restricted ? "restricted " : "", (int)(userpass_startpass-userpass_start), userpass_start);
- else
- return va("%srcon", restricted ? "restricted " : "");
- return "restricted rcon";
+ return va("%srcon", restricted ? "restricted " : "");
}
void RCon_Execute(lhnetsocket_t *mysocket, lhnetaddress_t *peeraddress, const char *addressstring2, const char *userlevel, const char *s, const char *endpos)
int i, ret, clientnum, best;
double besttime;
client_t *client;
- char *s, *string, response[1400], addressstring2[128], stringbuf[16384];
+ char *s, *string, response[1400], addressstring2[128];
+ static char stringbuf[16384];
qboolean islocal = (LHNETADDRESS_GetAddressType(peeraddress) == LHNETADDRESSTYPE_LOOP);
if (!sv.active)