Core/Network: Move to separate project

This commit is contained in:
Shauren
2025-04-09 21:02:31 +02:00
parent 6c374c56b2
commit 71b681bbf0
38 changed files with 245 additions and 156 deletions

View File

@@ -60,9 +60,13 @@ namespace Trinity
{
class DeadlineTimer;
class IoContext;
class Resolver;
class Strand;
}
namespace Net
{
class Resolver;
}
}
#endif // AsioHacksFwd_h__

View File

@@ -1,69 +0,0 @@
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef Resolver_h__
#define Resolver_h__
#include "IoContext.h"
#include "Optional.h"
#include <boost/asio/ip/tcp.hpp>
#include <algorithm>
#include <string_view>
#include <vector>
namespace Trinity
{
namespace Asio
{
/**
Hack to make it possible to forward declare resolver (one of its template arguments is a typedef to something super long and using nested classes)
*/
class Resolver
{
public:
explicit Resolver(IoContext& ioContext) : _impl(ioContext) { }
Optional<boost::asio::ip::tcp::endpoint> Resolve(boost::asio::ip::tcp const& protocol, std::string_view host, std::string_view service)
{
boost::system::error_code ec;
boost::asio::ip::resolver_base::flags flagsResolver = boost::asio::ip::resolver_base::all_matching;
boost::asio::ip::tcp::resolver::results_type results = _impl.resolve(protocol, host, service, flagsResolver, ec);
if (results.begin() == results.end() || ec)
return {};
return results.begin()->endpoint();
}
std::vector<boost::asio::ip::tcp::endpoint> ResolveAll(std::string_view host, std::string_view service)
{
boost::system::error_code ec;
boost::asio::ip::resolver_base::flags flagsResolver = boost::asio::ip::resolver_base::all_matching;
boost::asio::ip::tcp::resolver::results_type results = _impl.resolve(host, service, flagsResolver, ec);
std::vector<boost::asio::ip::tcp::endpoint> result;
if (!ec)
std::ranges::transform(results, std::back_inserter(result), [](boost::asio::ip::tcp::resolver::results_type::value_type const& entry) { return entry.endpoint(); });
return result;
}
private:
boost::asio::ip::tcp::resolver _impl;
};
}
}
#endif // Resolver_h__

View File

@@ -14,7 +14,8 @@ CollectSourceFiles(
# Exclude
${CMAKE_CURRENT_SOURCE_DIR}/Debugging/Windows
${CMAKE_CURRENT_SOURCE_DIR}/Platform
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders
${CMAKE_CURRENT_SOURCE_DIR}/network)
if(WIN32)
CollectSourceFiles(
@@ -27,6 +28,8 @@ if(WIN32)
WINDOWS_PLATFORM_SOURCES)
list(APPEND PRIVATE_SOURCES
${WINDOWS_PLATFORM_SOURCES})
unset(WINDOWS_DEBUGGING_SOURCES)
unset(WINDOWS_PLATFORM_SOURCES)
endif()
if(USE_COREPCH)
@@ -43,7 +46,8 @@ CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
# Exclude
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders)
${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders
${CMAKE_CURRENT_SOURCE_DIR}/network)
target_include_directories(common
PUBLIC
@@ -95,3 +99,9 @@ endif()
if(USE_COREPCH)
add_cxx_pch(common ${PRIVATE_PCH_HEADER})
endif()
unset(PRIVATE_SOURCES)
unset(PRIVATE_PCH_HEADER)
unset(PUBLIC_INCLUDES)
add_subdirectory(network)

View File

@@ -111,6 +111,12 @@
# define TC_DATABASE_API TC_API_IMPORT
#endif
#ifdef TRINITY_API_EXPORT_NETWORK
# define TC_NETWORK_API TC_API_EXPORT
#else
# define TC_NETWORK_API TC_API_IMPORT
#endif
#ifdef TRINITY_API_EXPORT_SHARED
# define TC_SHARED_API TC_API_EXPORT
#else

View File

@@ -18,7 +18,6 @@
#include "Util.h"
#include "Common.h"
#include "Containers.h"
#include "IpAddress.h"
#include "StringConvert.h"
#include "StringFormat.h"
#include <boost/core/demangle.hpp>
@@ -29,6 +28,10 @@
#include <cstdarg>
#include <ctime>
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
#include <Windows.h>
#endif
void Trinity::VerifyOsVersion()
{
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
@@ -270,17 +273,6 @@ std::string TimeToHumanReadable(time_t t)
return std::string(buf);
}
/// Check if the string is a valid ip address representation
bool IsIPAddress(char const* ipaddress)
{
if (!ipaddress)
return false;
boost::system::error_code error;
Trinity::Net::make_address(ipaddress, error);
return !error;
}
/// create PID file
uint32 CreatePIDFile(std::string const& filename)
{

View File

@@ -390,8 +390,6 @@ TC_COMMON_API bool WriteWinConsole(std::string_view str, bool error = false);
TC_COMMON_API Optional<std::size_t> RemoveCRLF(std::string& str);
TC_COMMON_API bool IsIPAddress(char const* ipaddress);
TC_COMMON_API uint32 CreatePIDFile(std::string const& filename);
TC_COMMON_API uint32 GetPID();

View File

@@ -0,0 +1,53 @@
# This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
# modifications, as long as this notice is preserved.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CollectSourceFiles(
${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE_SOURCES)
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
add_library(network
${PRIVATE_SOURCES})
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES)
target_include_directories(network
PUBLIC
${PUBLIC_INCLUDES}
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(network
PRIVATE
trinity-core-interface
PUBLIC
common)
set_target_properties(network
PROPERTIES
COMPILE_WARNING_AS_ERROR ${WITH_WARNINGS_AS_ERRORS}
DEFINE_SYMBOL TRINITY_API_EXPORT_NETWORK
FOLDER "server"
OUTPUT_NAME trinity_network)
if(BUILD_SHARED_LIBS)
if(UNIX)
install(TARGETS network
LIBRARY
DESTINATION lib)
elseif(WIN32)
install(TARGETS network
RUNTIME
DESTINATION "${CMAKE_INSTALL_PREFIX}")
endif()
endif()

View File

@@ -19,11 +19,9 @@
#define TRINITYCORE_BASE_HTTP_SOCKET_H
#include "AsyncCallbackProcessor.h"
#include "DatabaseEnvFwd.h"
#include "HttpCommon.h"
#include "HttpSessionState.h"
#include "Optional.h"
#include "QueryCallback.h"
#include "Socket.h"
#include "SocketConnectionInitializer.h"
#include <boost/beast/core/basic_stream.hpp>
@@ -67,7 +65,7 @@ public:
using RequestParser = boost::beast::http::request_parser<RequestBody>;
class TC_SHARED_API AbstractSocket
class TC_NETWORK_API AbstractSocket
{
public:
AbstractSocket() = default;
@@ -86,8 +84,6 @@ public:
void LogRequestAndResponse(RequestContext const& context, MessageBuffer& buffer) const;
virtual void QueueQuery(QueryCallback&& queryCallback) = 0;
virtual std::string GetClientInfo() const = 0;
static std::string GetClientInfo(boost::asio::ip::address const& address, uint16 port, SessionState const* state);
@@ -197,21 +193,9 @@ public:
this->DelayedCloseSocket();
}
void QueueQuery(QueryCallback&& queryCallback) final
{
this->_queryProcessor.AddCallback(std::move(queryCallback));
}
void Start() override { return this->Base::Start(); }
bool Update() override
{
if (!this->Base::Update())
return false;
this->_queryProcessor.ProcessReadyCallbacks();
return true;
}
bool Update() override { return this->Base::Update(); }
boost::asio::ip::address const& GetRemoteIpAddress() const final { return this->Base::GetRemoteIpAddress(); }
@@ -236,7 +220,6 @@ public:
protected:
virtual std::shared_ptr<SessionState> ObtainSessionState(RequestContext& context) const = 0;
QueryCallbackProcessor _queryProcessor;
Optional<RequestParser> _httpParser;
std::shared_ptr<SessionState> _state;
};

View File

@@ -37,8 +37,8 @@ struct RequestContext
struct RequestHandler const* handler = nullptr;
};
TC_SHARED_API bool CanLogRequestContent(RequestContext const& context);
TC_SHARED_API bool CanLogResponseContent(RequestContext const& context);
TC_NETWORK_API bool CanLogRequestContent(RequestContext const& context);
TC_NETWORK_API bool CanLogResponseContent(RequestContext const& context);
inline std::string_view ToStdStringView(boost::beast::string_view bsw)
{

View File

@@ -51,7 +51,7 @@ struct RequestHandler
EnumFlag<RequestHandlerFlag> Flags = RequestHandlerFlag::None;
};
class TC_SHARED_API DispatcherService
class TC_NETWORK_API DispatcherService
{
public:
explicit DispatcherService(std::string_view loggerSuffix) : _logger("server.http.dispatcher.")
@@ -79,7 +79,7 @@ private:
std::string _logger;
};
class TC_SHARED_API SessionService
class TC_NETWORK_API SessionService
{
public:
explicit SessionService(std::string_view loggerSuffix) : _logger("server.http.session.")

View File

@@ -15,22 +15,19 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef IpAddress_h__
#define IpAddress_h__
#ifndef TRINITYCORE_IP_ADDRESS_H
#define TRINITYCORE_IP_ADDRESS_H
#include "Define.h"
#include <boost/asio/ip/address.hpp>
namespace Trinity
namespace Trinity::Net
{
namespace Net
{
using boost::asio::ip::make_address;
using boost::asio::ip::make_address_v4;
using boost::asio::ip::make_address_v6;
using boost::asio::ip::v4_mapped_t::v4_mapped;
inline uint32 address_to_uint(boost::asio::ip::address_v4 const& address) { return address.to_uint(); }
}
using boost::asio::ip::make_address;
using boost::asio::ip::make_address_v4;
using boost::asio::ip::make_address_v6;
using boost::asio::ip::v4_mapped_t::v4_mapped;
inline uint32 address_to_uint(boost::asio::ip::address_v4 const& address) { return address.to_uint(); }
}
#endif // IpAddress_h__
#endif // TRINITYCORE_IP_ADDRESS_H

View File

@@ -33,7 +33,7 @@ bool IsInLocalNetwork(boost::asio::ip::address const& clientAddress)
{
if (clientAddress.is_v4())
{
return std::any_of(LocalV4Networks.begin(), LocalV4Networks.end(), [clientAddressV4 = clientAddress.to_v4()](boost::asio::ip::network_v4 const& network)
return std::ranges::any_of(LocalV4Networks, [clientAddressV4 = clientAddress.to_v4()](boost::asio::ip::network_v4 const& network)
{
return IsInNetwork(network, clientAddressV4);
});
@@ -41,7 +41,7 @@ bool IsInLocalNetwork(boost::asio::ip::address const& clientAddress)
if (clientAddress.is_v6())
{
return std::any_of(LocalV6Networks.begin(), LocalV6Networks.end(), [clientAddressV6 = clientAddress.to_v6()](boost::asio::ip::network_v6 const& network)
return std::ranges::any_of(LocalV6Networks, [clientAddressV6 = clientAddress.to_v6()](boost::asio::ip::network_v6 const& network)
{
return IsInNetwork(network, clientAddressV6);
});

View File

@@ -15,8 +15,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef IpNetwork_h__
#define IpNetwork_h__
#ifndef TRINITYCORE_IP_NETWORK_H
#define TRINITYCORE_IP_NETWORK_H
#include "AsioHacksFwd.h"
#include "Define.h"
@@ -25,15 +25,15 @@
namespace Trinity::Net
{
TC_COMMON_API bool IsInLocalNetwork(boost::asio::ip::address const& clientAddress);
TC_NETWORK_API bool IsInLocalNetwork(boost::asio::ip::address const& clientAddress);
TC_COMMON_API bool IsInNetwork(boost::asio::ip::network_v4 const& network, boost::asio::ip::address_v4 const& clientAddress);
TC_NETWORK_API bool IsInNetwork(boost::asio::ip::network_v4 const& network, boost::asio::ip::address_v4 const& clientAddress);
TC_COMMON_API bool IsInNetwork(boost::asio::ip::network_v6 const& network, boost::asio::ip::address_v6 const& clientAddress);
TC_NETWORK_API bool IsInNetwork(boost::asio::ip::network_v6 const& network, boost::asio::ip::address_v6 const& clientAddress);
TC_COMMON_API Optional<std::size_t> SelectAddressForClient(boost::asio::ip::address const& clientAddress, std::span<boost::asio::ip::address const> const& addresses);
TC_NETWORK_API Optional<std::size_t> SelectAddressForClient(boost::asio::ip::address const& clientAddress, std::span<boost::asio::ip::address const> const& addresses);
TC_COMMON_API void ScanLocalNetworks();
TC_NETWORK_API void ScanLocalNetworks();
}
#endif // IpNetwork_h__
#endif // TRINITYCORE_IP_NETWORK_H

View File

@@ -0,0 +1,47 @@
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Resolver.h"
#include <algorithm>
Optional<boost::asio::ip::tcp::endpoint> Trinity::Net::Resolver::Resolve(boost::asio::ip::tcp const& protocol, std::string_view host, std::string_view service)
{
boost::system::error_code ec;
boost::asio::ip::resolver_base::flags flagsResolver = boost::asio::ip::resolver_base::all_matching;
boost::asio::ip::tcp::resolver::results_type results = _impl.resolve(protocol, host, service, flagsResolver, ec);
Optional<boost::asio::ip::tcp::endpoint> result;
if (!ec)
if (auto itr = results.begin(); itr != results.end())
result.emplace(itr->endpoint());
return result;
}
std::vector<boost::asio::ip::tcp::endpoint> Trinity::Net::Resolver::ResolveAll(std::string_view host, std::string_view service)
{
boost::system::error_code ec;
boost::asio::ip::resolver_base::flags flagsResolver = boost::asio::ip::resolver_base::all_matching;
boost::asio::ip::tcp::resolver::results_type results = _impl.resolve(host, service, flagsResolver, ec);
std::vector<boost::asio::ip::tcp::endpoint> result;
if (!ec)
{
result.resize(results.size());
std::ranges::transform(results, result.begin(), [](boost::asio::ip::tcp::resolver::results_type::value_type const& entry) { return entry.endpoint(); });
}
return result;
}

View File

@@ -0,0 +1,47 @@
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRINITYCORE_RESOLVER_H
#define TRINITYCORE_RESOLVER_H
#include "Define.h"
#include "IoContext.h"
#include "Optional.h"
#include <boost/asio/ip/tcp.hpp>
#include <string_view>
#include <vector>
namespace Trinity::Net
{
/**
Hack to make it possible to forward declare resolver (one of its template arguments is a typedef to something super long and using nested classes)
*/
class TC_NETWORK_API Resolver
{
public:
explicit Resolver(Asio::IoContext& ioContext) : _impl(ioContext) { }
Optional<boost::asio::ip::tcp::endpoint> Resolve(boost::asio::ip::tcp const& protocol, std::string_view host, std::string_view service);
std::vector<boost::asio::ip::tcp::endpoint> ResolveAll(std::string_view host, std::string_view service);
private:
boost::asio::ip::tcp::resolver _impl;
};
}
#endif // TRINITYCORE_RESOLVER_H

View File

@@ -83,7 +83,7 @@ public:
// build initializer chain
boost::container::static_vector<std::shared_ptr<Trinity::Net::SocketConnectionInitializer>, 4> initializers;
initializers.stable_emplace_back(std::make_shared<Trinity::Net::IpBanCheckConnectionInitializer<BaseSocket>>(this));
initializers.stable_emplace_back(std::make_shared<Trinity::Net::IpBanCheckConnectionInitializer<Battlenet::LoginHttpSession>>(&_owner));
if constexpr (std::is_same_v<BaseSocket, Trinity::Net::Http::SslSocket>)
initializers.stable_emplace_back(std::make_shared<Trinity::Net::SslHandshakeConnectionInitializer<BaseSocket>>(this));
@@ -124,10 +124,26 @@ LoginHttpSession::LoginHttpSession(Trinity::Net::IoContextTcpSocket&& socket)
{
}
LoginHttpSession::~LoginHttpSession() = default;
void LoginHttpSession::Start()
{
TC_LOG_TRACE("server.http.session", "{} Accepted connection", GetClientInfo());
return _socket->Start();
}
bool LoginHttpSession::Update()
{
if (!_socket->Update())
return false;
_queryProcessor.ProcessReadyCallbacks();
return true;
}
void LoginHttpSession::QueueQuery(QueryCallback&& queryCallback)
{
_queryProcessor.AddCallback(std::move(queryCallback));
}
}

View File

@@ -18,7 +18,9 @@
#ifndef TRINITYCORE_LOGIN_HTTP_SESSION_H
#define TRINITYCORE_LOGIN_HTTP_SESSION_H
#include "AsyncCallbackProcessor.h"
#include "BaseHttpSocket.h"
#include "DatabaseEnvFwd.h"
#include "SRP6.h"
namespace Battlenet
@@ -34,20 +36,22 @@ public:
static constexpr std::string_view SESSION_ID_COOKIE = "JSESSIONID=";
explicit LoginHttpSession(Trinity::Net::IoContextTcpSocket&& socket);
~LoginHttpSession();
void Start() override;
bool Update() override { return _socket->Update(); }
bool Update() override;
boost::asio::ip::address const& GetRemoteIpAddress() const override { return _socket->GetRemoteIpAddress(); }
bool IsOpen() const override { return _socket->IsOpen(); }
void CloseSocket() override { return _socket->CloseSocket(); }
void SendResponse(Trinity::Net::Http::RequestContext& context) override { return _socket->SendResponse(context); }
void QueueQuery(QueryCallback&& queryCallback) override { return _socket->QueueQuery(std::move(queryCallback)); }
void QueueQuery(QueryCallback&& queryCallback);
std::string GetClientInfo() const override { return _socket->GetClientInfo(); }
LoginSessionState* GetSessionState() const override { return static_cast<LoginSessionState*>(_socket->GetSessionState()); }
private:
std::shared_ptr<Trinity::Net::Http::AbstractSocket> _socket;
QueryCallbackProcessor _queryProcessor;
};
}

View File

@@ -80,7 +80,7 @@ bool LoginRESTService::StartNetwork(Trinity::Asio::IoContext& ioContext, std::st
using namespace std::string_literals;
std::array<std::string, 2> configKeys = { { "LoginREST.ExternalAddress"s, "LoginREST.LocalAddress"s } };
Trinity::Asio::Resolver resolver(ioContext);
Trinity::Net::Resolver resolver(ioContext);
for (std::size_t i = 0; i < _hostnames.size(); ++i)
{

View File

@@ -29,6 +29,7 @@ EndScriptData */
#include "ChatCommand.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "IpAddress.h"
#include "Language.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
@@ -161,6 +162,13 @@ public:
return HandleBanHelper(BAN_IP, args, handler);
}
static bool IsIPAddress(std::string const& text)
{
boost::system::error_code error;
Trinity::Net::make_address(text, error);
return !error;
}
static bool HandleBanHelper(BanMode mode, char const* args, ChatHandler* handler)
{
if (!*args)
@@ -199,7 +207,7 @@ public:
}
break;
case BAN_IP:
if (!IsIPAddress(nameOrIP.c_str()))
if (!IsIPAddress(nameOrIP))
return false;
break;
}
@@ -360,22 +368,13 @@ public:
return true;
}
static bool HandleBanInfoIPCommand(ChatHandler* handler, char const* args)
static bool HandleBanInfoIPCommand(ChatHandler* handler, std::string&& ip)
{
if (!*args)
if (!IsIPAddress(ip))
return false;
char* ipStr = strtok((char*)args, "");
if (!ipStr)
return false;
if (!IsIPAddress(ipStr))
return false;
std::string IP = ipStr;
LoginDatabase.EscapeString(IP);
QueryResult result = LoginDatabase.PQuery("SELECT ip, FROM_UNIXTIME(bandate), FROM_UNIXTIME(unbandate), unbandate-UNIX_TIMESTAMP(), banreason, bannedby, unbandate-bandate FROM ip_banned WHERE ip = '{}'", IP);
LoginDatabase.EscapeString(ip);
QueryResult result = LoginDatabase.PQuery("SELECT ip, FROM_UNIXTIME(bandate), FROM_UNIXTIME(unbandate), unbandate-UNIX_TIMESTAMP(), banreason, bannedby, unbandate-bandate FROM ip_banned WHERE ip = '{}'", ip);
if (!result)
{
handler->PSendSysMessage(LANG_BANINFO_NOIP);
@@ -745,7 +744,7 @@ public:
}
break;
case BAN_IP:
if (!IsIPAddress(nameOrIP.c_str()))
if (!IsIPAddress(nameOrIP))
return false;
break;
}

View File

@@ -41,6 +41,7 @@ target_link_libraries(shared
trinity-core-interface
PUBLIC
database
network
rapidjson
proto
zlib)

View File

@@ -35,7 +35,7 @@ struct IpLocationRecord
std::string CountryName;
};
class TC_COMMON_API IpLocationStore
class TC_SHARED_API IpLocationStore
{
public:
IpLocationStore();

View File

@@ -47,7 +47,7 @@ struct IpBanCheckConnectionInitializer final : SocketConnectionInitializer
if (IpBanCheckHelpers::IsBanned(result))
{
TC_LOG_ERROR("network", "IpBanCheckConnectionInitializer: IP {} is banned.", socket->GetRemoteIpAddress().to_string());
socket->DelayedCloseSocket();
socket->CloseSocket();
return;
}

View File

@@ -68,7 +68,7 @@ void RealmList::Initialize(Trinity::Asio::IoContext& ioContext, uint32 updateInt
{
_updateInterval = updateInterval;
_updateTimer = std::make_unique<Trinity::Asio::DeadlineTimer>(ioContext);
_resolver = std::make_unique<Trinity::Asio::Resolver>(ioContext);
_resolver = std::make_unique<Trinity::Net::Resolver>(ioContext);
ClientBuild::LoadBuildInfo();
// Get the content of the realmlist table in the database

View File

@@ -86,7 +86,7 @@ private:
std::unordered_set<std::string> _subRegions;
uint32 _updateInterval;
std::unique_ptr<Trinity::Asio::DeadlineTimer> _updateTimer;
std::unique_ptr<Trinity::Asio::Resolver> _resolver;
std::unique_ptr<Trinity::Net::Resolver> _resolver;
Optional<Battlenet::RealmHandle> _currentRealmId;
};

View File

@@ -19,7 +19,8 @@ target_link_libraries(extractor_common
trinity-core-interface
PUBLIC
casc
common)
common
network)
target_include_directories(extractor_common
PUBLIC

View File

@@ -65,7 +65,7 @@ namespace
sslContext.set_options(boost::asio::ssl::context::no_tlsv1_1, error);
sslContext.set_default_verify_paths(error);
Trinity::Asio::Resolver resolver(ioContext);
Trinity::Net::Resolver resolver(ioContext);
Optional<boost::asio::ip::tcp::endpoint> endpoint = resolver.Resolve(boost::asio::ip::tcp::v4(), serverName, std::to_string(port));
if (!endpoint)