Add sv_netlimit

This commit is contained in:
def 2013-08-04 04:32:04 +02:00
parent da778f4e66
commit b51cc77189
2 changed files with 4 additions and 1 deletions

View file

@ -856,7 +856,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
} }
else else
{ {
if ((Now - m_aClients[ClientID].m_TrafficSince) / time_freq() > 0 && m_aClients[ClientID].m_Traffic / ((Now - m_aClients[ClientID].m_TrafficSince) / time_freq()) > 100000) if ((Now - m_aClients[ClientID].m_TrafficSince) / time_freq() > 0 && m_aClients[ClientID].m_Traffic / ((Now - m_aClients[ClientID].m_TrafficSince) / time_freq()) > g_Config.m_SvNetlimit)
{ {
m_NetServer.NetBan()->BanAddr(&pPacket->m_Address, 60, "Stressing network"); m_NetServer.NetBan()->BanAddr(&pPacket->m_Address, 60, "Stressing network");
return; return;

View file

@ -221,4 +221,7 @@ MACRO_CONFIG_INT(SvGlobalBantime, sv_global_ban_time, 60, 0, 1440, CFGFLAG_SERVE
MACRO_CONFIG_INT(SvEvents, sv_events, 1, 0, 1, CFGFLAG_SERVER, "Enable triggering of server events, like the happy eyeemotes on some holidays.") MACRO_CONFIG_INT(SvEvents, sv_events, 1, 0, 1, CFGFLAG_SERVER, "Enable triggering of server events, like the happy eyeemotes on some holidays.")
// netlimit
MACRO_CONFIG_INT(SvNetlimit, sv_netlimit, 10000, 1000, 1000000, CFGFLAG_SERVER, "Netlimit: Maximum amount of traffic a client is allowed to use (in kb/s)")
#endif #endif