return conn;
}
+void NetConn_ClearConnectFlood(lhnetaddress_t *peeraddress);
void NetConn_Close(netconn_t *conn)
{
netconn_t *c;
// remove connection from list
+
+ // allow the client to reconnect immediately
+ NetConn_ClearConnectFlood(&(conn->peeraddress));
+
if (conn == netconn_list)
netconn_list = conn->next;
else
// renew the ban on this address so it does not expire
// until the flood has subsided
sv.connectfloodaddresses[floodslotnum].lasttime = realtime;
+ //Con_Printf("Flood detected!\n");
return true;
}
// the flood appears to have subsided, so allow this
// begin a new timeout on this address
sv.connectfloodaddresses[bestfloodslotnum].address = noportpeeraddress;
sv.connectfloodaddresses[bestfloodslotnum].lasttime = realtime;
+ //Con_Printf("Flood detection initiated!\n");
return false;
}
+void NetConn_ClearConnectFlood(lhnetaddress_t *peeraddress)
+{
+ int floodslotnum;
+ lhnetaddress_t noportpeeraddress;
+ // see if this is a connect flood
+ noportpeeraddress = *peeraddress;
+ LHNETADDRESS_SetPort(&noportpeeraddress, 0);
+ for (floodslotnum = 0;floodslotnum < MAX_CONNECTFLOODADDRESSES;floodslotnum++)
+ {
+ if (sv.connectfloodaddresses[floodslotnum].lasttime && LHNETADDRESS_Compare(&noportpeeraddress, &sv.connectfloodaddresses[floodslotnum].address) == 0)
+ {
+ // this address matches an ongoing flood address
+ // remove the ban
+ sv.connectfloodaddresses[floodslotnum].address.addresstype = LHNETADDRESSTYPE_NONE;
+ sv.connectfloodaddresses[floodslotnum].lasttime = 0;
+ //Con_Printf("Flood cleared!\n");
+ }
+ }
+}
+
extern void SV_SendServerinfo (client_t *client);
static int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, unsigned char *data, int length, lhnetaddress_t *peeraddress)
{