conn = Mem_Alloc(netconn_mempool, sizeof(*conn));
conn->mysocket = mysocket;
conn->peeraddress = *peeraddress;
- // updated by receiving "rate" command from client
- conn->rate = NET_MINRATE;
- // no limits for local player
- if (LHNETADDRESS_GetAddressType(peeraddress) == LHNETADDRESSTYPE_LOOP)
- conn->rate = 1000000000;
conn->canSend = true;
- conn->connecttime = realtime;
conn->lastMessageTime = realtime;
// LordHavoc: (inspired by ProQuake) use a short connect timeout to
// reduce effectiveness of connection request floods
buffer[i] = 0;
}
-extern void SV_ConnectClient(int clientnum, netconn_t *netconnection);
int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, qbyte *data, int length, lhnetaddress_t *peeraddress)
{
int i, n, ret, clientnum, responselength, best;
if (clientnum < svs.maxclients)
{
// duplicate connection request
- if (realtime - client->netconnection->connecttime < 2.0)
+ if (realtime - client->connecttime < 2.0)
{
// client is still trying to connect,
// so we send a duplicate reply
if (clientnum < svs.maxclients)
{
// duplicate connection request
- if (realtime - client->netconnection->connecttime < 2.0)
+ if (realtime - client->connecttime < 2.0)
{
// client is still trying to connect,
// so we send a duplicate reply
MSG_WriteString(&net_message, client->name);
MSG_WriteLong(&net_message, client->colors);
MSG_WriteLong(&net_message, (int)client->edict->v->frags);
- MSG_WriteLong(&net_message, (int)(realtime - client->netconnection->connecttime));
- MSG_WriteString(&net_message, client->netconnection->address);
+ MSG_WriteLong(&net_message, (int)(realtime - client->connecttime));
+ MSG_WriteString(&net_message, client->netconnection ? client->netconnection->address : "botclient");
*((int *)net_message.data) = BigLong(NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK));
NetConn_Write(mysocket, net_message.data, net_message.cursize, peeraddress);
SZ_Clear(&net_message);
{
if (host_client->netconnection && host_client->netconnection->mysocket == mysocket && !LHNETADDRESS_Compare(&host_client->netconnection->peeraddress, peeraddress))
{
- sv_player = host_client->edict;
if ((ret = NetConn_ReceivedMessage(host_client->netconnection, data, length)) == 2)
SV_ReadClientMessage();
return ret;
for (i = 0, host_client = svs.clients;i < svs.maxclients;i++, host_client++)
{
// never timeout loopback connections
- if (host_client->netconnection && realtime > host_client->netconnection->timeout && LHNETADDRESS_GetAddressType(LHNET_AddressFromSocket(host_client->netconnection->mysocket)) != LHNETADDRESSTYPE_LOOP)
+ if (host_client->netconnection && realtime > host_client->netconnection->timeout && LHNETADDRESS_GetAddressType(&host_client->netconnection->peeraddress) != LHNETADDRESSTYPE_LOOP)
{
Con_Printf("Client \"%s\" connection timed out\n", host_client->name);
- sv_player = host_client->edict;
SV_DropClient(false);
}
}