mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Add sv_max_server_info_per_second
This controls how many complete server info responses are sent per second.
This commit is contained in:
parent
b29a733c4f
commit
96f0eddbb8
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue