Core/Network: Minor include cleanup in SocketConnectionInitializer related files

This commit is contained in:
Shauren
2025-09-22 16:12:01 +02:00
parent bb1cc8a48f
commit df02bec2a1
9 changed files with 63 additions and 21 deletions

View File

@@ -17,6 +17,8 @@
#include "IpBanCheckConnectionInitializer.h"
#include "DatabaseEnv.h"
#include "IpAddress.h"
#include "Log.h"
QueryCallback Trinity::Net::IpBanCheckHelpers::AsyncQuery(boost::asio::ip::address const& ipAddress)
{
@@ -40,3 +42,8 @@ bool Trinity::Net::IpBanCheckHelpers::IsBanned(PreparedQueryResult const& result
return false;
}
void Trinity::Net::IpBanCheckHelpers::LogFailure(boost::asio::ip::address const& ipAddress)
{
TC_LOG_ERROR("network", "IpBanCheckConnectionInitializer: IP {} is banned.", ipAddress);
}

View File

@@ -18,9 +18,8 @@
#ifndef TRINITYCORE_IP_BAN_CHECK_CONNECTION_INITIALIZER_H
#define TRINITYCORE_IP_BAN_CHECK_CONNECTION_INITIALIZER_H
#include "AsioHacksFwd.h"
#include "DatabaseEnvFwd.h"
#include "IpAddress.h"
#include "Log.h"
#include "QueryCallback.h"
#include "SocketConnectionInitializer.h"
@@ -30,6 +29,7 @@ namespace IpBanCheckHelpers
{
TC_SHARED_API QueryCallback AsyncQuery(boost::asio::ip::address const& ipAddress);
TC_SHARED_API bool IsBanned(PreparedQueryResult const& result);
TC_SHARED_API void LogFailure(boost::asio::ip::address const& ipAddress);
}
template <typename SocketImpl>
@@ -47,13 +47,12 @@ struct IpBanCheckConnectionInitializer final : SocketConnectionInitializer
if (IpBanCheckHelpers::IsBanned(result))
{
TC_LOG_ERROR("network", "IpBanCheckConnectionInitializer: IP {} is banned.", socket->GetRemoteIpAddress());
IpBanCheckHelpers::LogFailure(socket->GetRemoteIpAddress());
socket->CloseSocket();
return;
}
if (self->next)
self->next->Start();
self->InvokeNext();
}));
}