Add sv_max_server_info_per_second

This controls how many complete server info responses are sent per
second.
This commit is contained in:
heinrich5991 2016-01-22 16:42:54 +01:00
parent b29a733c4f
commit 96f0eddbb8
2 changed files with 4 additions and 3 deletions

View file

@ -1272,7 +1272,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
void CServer::SendServerInfoConnless(const NETADDR *pAddr, int Token, bool Extended)
{
static const int MAX_REQUESTS_PER_SECOND = 10;
const int MaxRequests = g_Config.m_SvServerInfoPerSecond;
int64 Now = Tick();
if(Now <= m_ServerInfoFirstRequest + TickSpeed())
{
@ -1280,12 +1280,12 @@ void CServer::SendServerInfoConnless(const NETADDR *pAddr, int Token, bool Exten
}
else
{
m_ServerInfoHighLoad = m_ServerInfoNumRequests > MAX_REQUESTS_PER_SECOND;
m_ServerInfoHighLoad = m_ServerInfoNumRequests > MaxRequests;
m_ServerInfoNumRequests = 1;
m_ServerInfoFirstRequest = Now;
}
bool Short = m_ServerInfoNumRequests > MAX_REQUESTS_PER_SECOND || m_ServerInfoHighLoad;
bool Short = m_ServerInfoNumRequests > MaxRequests || m_ServerInfoHighLoad;
SendServerInfo(pAddr, Token, Extended, 0, Short);
}

View file

@ -150,6 +150,7 @@ MACRO_CONFIG_INT(SvVanillaAntiSpoof, sv_vanilla_antispoof, 1, 0, 1, CFGFLAG_SERV
MACRO_CONFIG_INT(SvPlayerDemoRecord, sv_player_demo_record, 0, 0, 1, CFGFLAG_SERVER, "Automatically record demos for each player")
MACRO_CONFIG_INT(SvDemoChat, sv_demo_chat, 0, 0, 1, CFGFLAG_SERVER, "Record chat for demos")
MACRO_CONFIG_INT(SvServerInfoPerSecond, sv_server_info_per_second, 10, 1, 1000, CFGFLAG_SERVER, "Maximum number of complete server info responses that are sent out per second")
MACRO_CONFIG_STR(EcBindaddr, ec_bindaddr, 128, "localhost", CFGFLAG_ECON, "Address to bind the external console to. Anything but 'localhost' is dangerous")
MACRO_CONFIG_INT(EcPort, ec_port, 0, 0, 0, CFGFLAG_ECON, "Port to use for the external console")