2
0
mirror of https://github.com/rehlds/rehlds.git synced 2024-12-29 08:05:50 +03:00

Merge pull request #659 from dreamstalker/ipbans_check

Optimize check for bans by ip
This commit is contained in:
theAsmodai 2018-09-29 12:47:34 +03:00 committed by GitHub
commit 2444c9fe15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3586,11 +3586,13 @@ void SV_ReadPackets(void)
{ {
while (NET_GetPacket(NS_SERVER)) while (NET_GetPacket(NS_SERVER))
{ {
#ifndef REHLDS_FIXES
if (SV_FilterPacket()) if (SV_FilterPacket())
{ {
SV_SendBan(); SV_SendBan();
continue; continue;
} }
#endif
bool pass = g_RehldsHookchains.m_PreprocessPacket.callChain(NET_GetPacketPreprocessor, net_message.data, net_message.cursize, net_from); bool pass = g_RehldsHookchains.m_PreprocessPacket.callChain(NET_GetPacketPreprocessor, net_message.data, net_message.cursize, net_from);
if (!pass) if (!pass)
@ -3601,6 +3603,14 @@ void SV_ReadPackets(void)
// Connectionless packet // Connectionless packet
if (SV_CheckConnectionLessRateLimits(net_from)) if (SV_CheckConnectionLessRateLimits(net_from))
{ {
#ifdef REHLDS_FIXES
if (SV_FilterPacket())
{
SV_SendBan();
continue;
}
#endif
Steam_HandleIncomingPacket(net_message.data, net_message.cursize, ntohl(*(u_long *)&net_from.ip[0]), htons(net_from.port)); Steam_HandleIncomingPacket(net_message.data, net_message.cursize, ntohl(*(u_long *)&net_from.ip[0]), htons(net_from.port));
SV_ConnectionlessPacket(); SV_ConnectionlessPacket();
} }