diff --git a/src/game/Server/WorldSession.cpp b/src/game/Server/WorldSession.cpp index 74f0ecbe757..b364357eead 100644 --- a/src/game/Server/WorldSession.cpp +++ b/src/game/Server/WorldSession.cpp @@ -1199,7 +1199,7 @@ void WorldSession::SendTransferAborted(uint32 mapid, uint8 reason, uint8 arg) co void WorldSession::SendRedirectClient(std::string& ip, uint16 port) const { - const uint32 ip2 = static_cast(boost::asio::ip::address_v4::from_string(ip).to_ulong()); + const uint32 ip2 = static_cast(boost::asio::ip::make_address_v4(ip).to_uint()); WorldPacket pkt(SMSG_CONNECT_TO, 4 + 2 + 4 + 20); pkt << uint32(ip2); // inet_addr(ipstr) diff --git a/src/game/Server/WorldSocket.cpp b/src/game/Server/WorldSocket.cpp index acecfd2fb95..992f586957e 100644 --- a/src/game/Server/WorldSocket.cpp +++ b/src/game/Server/WorldSocket.cpp @@ -118,7 +118,7 @@ std::deque WorldSocket::GetIncOpcodeHistory() return m_opcodeHistoryInc; } -WorldSocket::WorldSocket(boost::asio::io_service& service) : AsyncSocket(service), m_lastPingTime(std::chrono::system_clock::time_point::min()), m_overSpeedPings(0), +WorldSocket::WorldSocket(boost::asio::io_context& context) : AsyncSocket(context), m_lastPingTime(std::chrono::system_clock::time_point::min()), m_overSpeedPings(0), m_session(nullptr), m_seed(urand()), m_loggingPackets(false) { } diff --git a/src/game/Server/WorldSocket.h b/src/game/Server/WorldSocket.h index 3f77603c618..09d696fe527 100644 --- a/src/game/Server/WorldSocket.h +++ b/src/game/Server/WorldSocket.h @@ -126,7 +126,7 @@ class WorldSocket : public MaNGOS::AsyncSocket bool m_loggingPackets; public: - WorldSocket(boost::asio::io_service& service); + WorldSocket(boost::asio::io_context& context); // send a packet \o/ void SendPacket(const WorldPacket& pct, bool immediate = false); diff --git a/src/mangosd/Master.cpp b/src/mangosd/Master.cpp index 69399ef0377..f5c592f2fb3 100644 --- a/src/mangosd/Master.cpp +++ b/src/mangosd/Master.cpp @@ -227,11 +227,11 @@ int Master::Run() } std::string bindIp = sConfig.GetStringDefault("BindIP", "0.0.0.0"); int32 port = int32(sWorld.getConfig(CONFIG_UINT32_PORT_WORLD)); - MaNGOS::AsyncListener listener(m_service, bindIp, port); + MaNGOS::AsyncListener listener(m_context, bindIp, port); std::vector threads; for (int32 i = 0; i < networkThreadCount; ++i) - threads.emplace_back([&]() { m_service.run(); }); + threads.emplace_back([&]() { m_context.run(); }); std::unique_ptr> raListener; std::string raBindIp = sConfig.GetStringDefault("Ra.IP", "0.0.0.0"); @@ -240,8 +240,8 @@ int Master::Run() bool raEnable = sConfig.GetBoolDefault("Ra.Enable", false); if (raEnable) { - raListener.reset(new MaNGOS::AsyncListener(m_raService, raBindIp, raPort)); - m_raThread = std::thread([this]() { m_raService.run(); }); + raListener.reset(new MaNGOS::AsyncListener(m_raContext, raBindIp, raPort)); + m_raThread = std::thread([this]() { m_raContext.run(); }); } std::unique_ptr soapThread; @@ -254,11 +254,11 @@ int Master::Run() world_thread.wait(); - m_service.stop(); + m_context.stop(); if (raEnable) { - m_raService.stop(); + m_raContext.stop(); m_raThread.join(); } diff --git a/src/mangosd/Master.h b/src/mangosd/Master.h index 091ff379ac6..2603011eaa1 100644 --- a/src/mangosd/Master.h +++ b/src/mangosd/Master.h @@ -44,8 +44,8 @@ class Master void clearOnlineAccounts(); - boost::asio::io_service m_service; - boost::asio::io_service m_raService; + boost::asio::io_context m_context; + boost::asio::io_context m_raContext; }; #define sMaster MaNGOS::Singleton::Instance() diff --git a/src/mangosd/RASocket.cpp b/src/mangosd/RASocket.cpp index ccc39f2f695..94f455017a8 100644 --- a/src/mangosd/RASocket.cpp +++ b/src/mangosd/RASocket.cpp @@ -37,8 +37,8 @@ #include /// RASocket constructor -RASocket::RASocket(boost::asio::io_service& service) : - MaNGOS::AsyncSocket(service), m_secure(sConfig.GetBoolDefault("RA.Secure", true)), +RASocket::RASocket(boost::asio::io_context& context) : + MaNGOS::AsyncSocket(context), m_secure(sConfig.GetBoolDefault("RA.Secure", true)), m_authLevel(AuthLevel::None), m_accountLevel(AccountTypes::SEC_PLAYER), m_accountId(0) { if (sConfig.IsSet("RA.Stricted")) diff --git a/src/mangosd/RASocket.h b/src/mangosd/RASocket.h index 6b6a40c99e6..4d9c90a46ff 100644 --- a/src/mangosd/RASocket.h +++ b/src/mangosd/RASocket.h @@ -56,7 +56,7 @@ class RASocket : public MaNGOS::AsyncSocket void Send(const std::string& message); public: - RASocket(boost::asio::io_service& service); + RASocket(boost::asio::io_context& context); virtual ~RASocket(); bool OnOpen() override; diff --git a/src/realmd/AuthSocket.cpp b/src/realmd/AuthSocket.cpp index 49bf19a543f..afcba7ed2f0 100644 --- a/src/realmd/AuthSocket.cpp +++ b/src/realmd/AuthSocket.cpp @@ -191,8 +191,8 @@ const char logonProofVersionInvalid[2] = { CMD_AUTH_LOGON_PROOF, AUTH_LOGON_FAIL const char logonProofUnknownAccountPinInvalid[4] = { CMD_AUTH_LOGON_PROOF, AUTH_LOGON_FAILED_UNKNOWN_ACCOUNT, 3, 0 }; /// Constructor - set the N and g values for SRP6 -AuthSocket::AuthSocket(boost::asio::io_service& service) - : AsyncSocket(service), _status(STATUS_CHALLENGE), _build(0), _accountSecurityLevel(SEC_PLAYER), m_timeoutTimer(service) +AuthSocket::AuthSocket(boost::asio::io_context& context) + : AsyncSocket(context), _status(STATUS_CHALLENGE), _build(0), _accountSecurityLevel(SEC_PLAYER), m_timeoutTimer(context) { } diff --git a/src/realmd/AuthSocket.h b/src/realmd/AuthSocket.h index 54bc5d81738..ea5ce1589e0 100644 --- a/src/realmd/AuthSocket.h +++ b/src/realmd/AuthSocket.h @@ -45,7 +45,7 @@ class AuthSocket : public MaNGOS::AsyncSocket public: const static int s_BYTE_SIZE = 32; - AuthSocket(boost::asio::io_service& service); + AuthSocket(boost::asio::io_context& context); bool OnOpen() override; diff --git a/src/realmd/Main.cpp b/src/realmd/Main.cpp index 663f1bbe90a..9f6cacfac9f 100644 --- a/src/realmd/Main.cpp +++ b/src/realmd/Main.cpp @@ -72,7 +72,7 @@ bool restart = false; DatabaseType LoginDatabase; // Accessor to the realm server database -boost::asio::io_service service; +boost::asio::io_context context; // Launch the realm server int main(int argc, char* argv[]) @@ -238,14 +238,14 @@ int main(int argc, char* argv[]) LoginDatabase.CommitTransaction(); uint32 networkThreadCount = sConfig.GetIntDefault("ListenerThreads", 1); - MaNGOS::AsyncListener listener(service, + MaNGOS::AsyncListener listener(context, sConfig.GetStringDefault("BindIP", "0.0.0.0"), sConfig.GetIntDefault("RealmServerPort", DEFAULT_REALMSERVER_PORT) ); std::vector threads; for (uint32 i = 0; i < networkThreadCount; ++i) - threads.emplace_back([&]() { service.run(); }); + threads.emplace_back([&]() { context.run(); }); // Catch termination signals HookSignals(); @@ -319,7 +319,7 @@ int main(int argc, char* argv[]) #endif } - service.stop(); + context.stop(); for (uint32 i = 0; i < networkThreadCount; ++i) threads[i].join(); diff --git a/src/shared/Metric/Metric.cpp b/src/shared/Metric/Metric.cpp index ac0d75767d8..15f5664b5a5 100644 --- a/src/shared/Metric/Metric.cpp +++ b/src/shared/Metric/Metric.cpp @@ -16,6 +16,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include +#include #include #include @@ -84,12 +86,15 @@ metric::metric::~metric() if (!m_enabled) return; - m_writeService.post([&] { + boost::asio::post(m_writeContext, [&] { m_sendTimer->cancel(); }); - m_queueServiceWork.reset(); - m_writeServiceWork.reset(); + m_queueContextWork.get()->reset(); + m_writeContextWork.get()->reset(); + + m_queueContextWork.reset(); + m_writeContextWork.reset(); m_queueServiceThread.join(); m_writeServiceThread.join(); @@ -108,17 +113,17 @@ void metric::metric::initialize() sConfig.GetStringDefault("Metric.Password", "") }; - m_sendTimer.reset(new boost::asio::deadline_timer(m_writeService)); - m_queueServiceWork.reset(new boost::asio::io_service::work(m_queueService)); - m_writeServiceWork.reset(new boost::asio::io_service::work(m_writeService)); + m_sendTimer.reset(new boost::asio::deadline_timer(m_writeContext)); + m_queueContextWork = std::make_unique>(boost::asio::make_work_guard(m_queueContext)); + m_writeContextWork = std::make_unique>(boost::asio::make_work_guard(m_writeContext)); // Start up service thread that will process all queued tasks m_queueServiceThread = std::thread([&] { - m_queueService.run(); + m_queueContext.run(); }); m_writeServiceThread = std::thread([&] { - m_writeService.run(); + m_writeContext.run(); }); schedule_timer(); @@ -138,7 +143,7 @@ void metric::metric::reload_config() return; } - m_writeService.post([&] + boost::asio::post(m_writeContext, [&] { m_connectionInfo = { sConfig.GetStringDefault("Metric.Address", "127.0.0.1"), @@ -160,7 +165,7 @@ void metric::metric::report(std::string measurement, std::map guard(m_queueWriteLock); m_measurementQueue.push_back(std::make_unique(measurement, tags, fields)); @@ -209,9 +214,9 @@ void metric::metric::send() boost::system::error_code error; // Hostname resolution - tcp::resolver resolver(m_writeService); - tcp::resolver::query query(m_connectionInfo.hostname, std::to_string(m_connectionInfo.port)); - tcp::resolver::iterator endpoint_iterator = resolver.resolve(query, error); + tcp::resolver resolver(m_writeContext); + auto endpoints = resolver.resolve(m_connectionInfo.hostname, std::to_string(m_connectionInfo.port), error); + auto endpoint_iterator = endpoints.begin(); if (error) { @@ -221,9 +226,9 @@ void metric::metric::send() error = boost::asio::error::host_not_found; - tcp::resolver::iterator end; + auto end = endpoints.end(); - tcp::socket socket(m_writeService); + tcp::socket socket(m_writeContext); while (error && endpoint_iterator != end) { socket.close(); diff --git a/src/shared/Metric/Metric.h b/src/shared/Metric/Metric.h index a1ce1b21829..dcfabe76c01 100644 --- a/src/shared/Metric/Metric.h +++ b/src/shared/Metric/Metric.h @@ -21,6 +21,8 @@ #include #include +#include +#include #include #include #include @@ -120,12 +122,12 @@ namespace metric void report(std::string measurement, std::map fields, std::map tags = {}); private: - boost::asio::io_service m_queueService; - boost::asio::io_service m_writeService; + boost::asio::io_context m_queueContext; + boost::asio::io_context m_writeContext; std::unique_ptr m_sendTimer; - std::unique_ptr m_queueServiceWork; - std::unique_ptr m_writeServiceWork; + std::unique_ptr> m_queueContextWork; + std::unique_ptr> m_writeContextWork; std::thread m_queueServiceThread; std::thread m_writeServiceThread; diff --git a/src/shared/Network/AsyncListener.hpp b/src/shared/Network/AsyncListener.hpp index 526c127669c..a395d42e21a 100644 --- a/src/shared/Network/AsyncListener.hpp +++ b/src/shared/Network/AsyncListener.hpp @@ -31,7 +31,7 @@ namespace MaNGOS { public: // constructor for accepting connection from client - AsyncListener(boost::asio::io_service& io_service, std::string const& bindIp, unsigned short port) : m_service(io_service), m_acceptor(io_service, boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(bindIp), port)) + AsyncListener(boost::asio::io_context& io_context, std::string const& bindIp, unsigned short port) : m_context(io_context), m_acceptor(io_context, boost::asio::ip::tcp::endpoint(boost::asio::ip::make_address(bindIp), port)) { startAccept(); } @@ -43,12 +43,12 @@ namespace MaNGOS startAccept(); } private: - boost::asio::io_service& m_service; + boost::asio::io_context& m_context; boost::asio::ip::tcp::acceptor m_acceptor; void startAccept() { // socket - std::shared_ptr connection = std::make_shared(m_service); + std::shared_ptr connection = std::make_shared(m_context); // asynchronous accept operation and wait for a new connection. m_acceptor.async_accept(connection->GetAsioSocket(), boost::bind(&AsyncListener::HandleAccept, this, connection, boost::asio::placeholders::error)); diff --git a/src/shared/Network/AsyncSocket.hpp b/src/shared/Network/AsyncSocket.hpp index 6f7dac9018b..4e4adbc06d9 100644 --- a/src/shared/Network/AsyncSocket.hpp +++ b/src/shared/Network/AsyncSocket.hpp @@ -32,7 +32,7 @@ namespace MaNGOS class AsyncSocket : public std::enable_shared_from_this { public: - AsyncSocket(boost::asio::io_service& io_service); + AsyncSocket(boost::asio::io_context& io_context); virtual ~AsyncSocket(); void Read(char* buffer, size_t length, std::function&& callback); @@ -74,7 +74,7 @@ namespace MaNGOS }; template - MaNGOS::AsyncSocket::AsyncSocket(boost::asio::io_service& io_service) : m_socket(io_service), m_address("0.0.0.0"), + MaNGOS::AsyncSocket::AsyncSocket(boost::asio::io_context& io_context) : m_socket(io_context), m_address("0.0.0.0"), m_remoteAddress(boost::asio::ip::address()), m_remotePort(0) { diff --git a/src/shared/Network/Socket.cpp b/src/shared/Network/Socket.cpp deleted file mode 100644 index 8ff39cb8115..00000000000 --- a/src/shared/Network/Socket.cpp +++ /dev/null @@ -1,307 +0,0 @@ -/* -* This file is part of the CMaNGOS 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, write to the Free Software -* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "Socket.hpp" -#include "Log/Log.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -namespace MaNGOS -{ - Socket::Socket(boost::asio::io_service& service, std::function closeHandler) - : m_writeState(WriteState::Idle), m_readState(ReadState::Idle), m_socket(service), - m_closeHandler(std::move(closeHandler)), m_outBufferFlushTimer(service), m_address("0.0.0.0"), - m_remoteAddress(boost::asio::ip::address()), m_remotePort(0){} - - bool Socket::Open() - { - try - { - m_address = m_socket.remote_endpoint().address().to_string(); - m_remoteEndpoint = boost::lexical_cast(m_socket.remote_endpoint()); - m_remoteAddress = m_socket.remote_endpoint().address(); - m_remotePort = m_socket.remote_endpoint().port(); - } - catch (boost::system::system_error& error) - { - sLog.outError("Socket::Open() failed to get remote address. Error: %s", error.what()); - return false; - } - - m_outBuffer.reset(new PacketBuffer); - m_secondaryOutBuffer.reset(new PacketBuffer); - m_inBuffer.reset(new PacketBuffer); - - StartAsyncRead(); - - return true; - } - - void Socket::Close() - { - std::lock_guard guard(m_closeMutex); - if (IsClosed()) - return; - - boost::system::error_code ec; - m_socket.shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec); - m_socket.close(); - - if (m_closeHandler) - m_closeHandler(this); - } - - void Socket::StartAsyncRead() - { - if (IsClosed()) - { - m_readState = ReadState::Idle; - return; - } - - std::shared_ptr ptr = shared(); - m_readState = ReadState::Reading; - m_socket.async_read_some(boost::asio::buffer(&m_inBuffer->m_buffer[m_inBuffer->m_writePosition], m_inBuffer->m_buffer.size() - m_inBuffer->m_writePosition), - make_custom_alloc_handler(m_allocator, - [ptr](const boost::system::error_code & error, size_t length) { ptr->OnRead(error, length); })); - } - - void Socket::OnRead(const boost::system::error_code& error, size_t length) - { - if (error) - { - m_readState = ReadState::Idle; - OnError(error); - return; - } - - if (IsClosed()) - { - m_readState = ReadState::Idle; - return; - } - - m_inBuffer->m_writePosition += length; - - const size_t available = m_socket.available(); - - // if there is still data to read, increase the buffer size and do so (if necessary) - if (available > 0 && (length + available) > m_inBuffer->m_buffer.size()) - { - m_inBuffer->m_buffer.resize(m_inBuffer->m_buffer.size() + available); - StartAsyncRead(); - return; - } - - // we must repeat this in case we have read in multiple messages from the client - while (m_inBuffer->m_readPosition < m_inBuffer->m_writePosition) - { - if (!ProcessIncomingData()) - { - // this errno is set when there is not enough buffer data available to either complete a header, or the packet length - // specified in the header goes past what we've read. in this case, we will reset the buffer with the remaining data - if (errno == EBADMSG) - { - const size_t bytesRemaining = m_inBuffer->m_writePosition - m_inBuffer->m_readPosition; - - ::memmove(&m_inBuffer->m_buffer[0], &m_inBuffer->m_buffer[m_inBuffer->m_readPosition], bytesRemaining); - - m_inBuffer->m_readPosition = 0; - m_inBuffer->m_writePosition = bytesRemaining; - - StartAsyncRead(); - } - else if (!IsClosed()) - Close(); - - return; - } - } - - // at this point, the packet has been read and successfully processed. reset the buffer. - m_inBuffer->m_writePosition = m_inBuffer->m_readPosition = 0; - - StartAsyncRead(); - } - - void Socket::OnError(const boost::system::error_code& error) - { - // skip logging this code because it happens whenever anyone disconnects. reduces spam. - if (error != boost::asio::error::eof && - error != boost::asio::error::operation_aborted) - sLog.outBasic("Socket::OnError. %s. Connection closed.", error.message().c_str()); - - if (!IsClosed()) - Close(); - } - - bool Socket::Read(char* buffer, int length) - { - if (ReadLengthRemaining() < length) - return false; - - m_inBuffer->Read(buffer, length); - return true; - } - - void Socket::Write(const char* header, int headerSize, const char* content, int contentSize) - { - std::lock_guard guard(m_mutex); - - // get the correct buffer depending on the current writing state - PacketBuffer* outBuffer = m_writeState == WriteState::Sending ? m_secondaryOutBuffer.get() : m_outBuffer.get(); - - // write the header - outBuffer->Write(header, headerSize); - - // write the content - outBuffer->Write(content, contentSize); - - // flush data if need - if (m_writeState == WriteState::Idle) - StartWriteFlushTimer(); - } - - void Socket::Write(const char* buffer, int length) - { - std::lock_guard guard(m_mutex); - - // get the correct buffer depending on the current writing state - PacketBuffer* outBuffer = m_writeState == WriteState::Sending ? m_secondaryOutBuffer.get() : m_outBuffer.get(); - - // write the header - outBuffer->Write(buffer, length); - - // flush data if need - if (m_writeState == WriteState::Idle) - StartWriteFlushTimer(); - } - -// note that this function assumes that the socket mutex is locked - void Socket::StartWriteFlushTimer() - { - if (m_writeState == WriteState::Buffering) - return; - - // if the socket is closed, silently fail - if (IsClosed()) - { - m_writeState = WriteState::Idle; - return; - } - - m_writeState = WriteState::Buffering; - - std::shared_ptr ptr = shared(); - m_outBufferFlushTimer.expires_from_now(boost::posix_time::milliseconds(int(BufferTimeout))); - m_outBufferFlushTimer.async_wait([ptr](const boost::system::error_code&) { ptr->FlushOut(); }); - } - - void Socket::FlushOut() - { - // if the socket is closed, silently fail - if (IsClosed()) - { - m_writeState = WriteState::Idle; - return; - } - - std::lock_guard guard(m_mutex); - - assert(m_writeState == WriteState::Buffering); - - // at this point we are guarunteed that there is data to send in the primary buffer. send it. - m_writeState = WriteState::Sending; - - std::shared_ptr ptr = shared(); - m_socket.async_write_some(boost::asio::buffer(m_outBuffer->m_buffer, m_outBuffer->m_writePosition), - make_custom_alloc_handler(m_allocator, - [ptr](const boost::system::error_code & error, size_t length) { ptr->OnWriteComplete(error, length); })); - } - -// if the write state is idle, this will do nothing, which is correct -// if the write state is sending, this will do nothing, which is correct -// if the write state is buffering, this will cancel the running timer, which will immediately trigger FlushOut() - void Socket::ForceFlushOut() - { - m_outBufferFlushTimer.cancel(); - } - - void Socket::OnWriteComplete(const boost::system::error_code& error, size_t length) - { - // we must check this before locking the mutex because the connection will be closed, - // which leads to a locked mutex being destroyed. not good! - if (error) - { - OnError(error); - return; - } - - if (IsClosed()) - { - m_writeState = WriteState::Idle; - return; - } - - std::lock_guard guard(m_mutex); - - assert(m_writeState == WriteState::Sending); - assert(length <= m_outBuffer->m_writePosition); - - // if there is data left to write, move it to the start of the buffer - if (length < m_outBuffer->m_writePosition) - { - memcpy(&(m_outBuffer->m_buffer[0]), &(m_outBuffer->m_buffer[length]), (m_outBuffer->m_writePosition - length) * sizeof(m_outBuffer->m_buffer[0])); - m_outBuffer->m_writePosition -= length; - } - // if not, reset the write pointer - else - m_outBuffer->m_writePosition = 0; - - // if there is data in the secondary buffer, append it to the primary buffer - if (m_secondaryOutBuffer->m_writePosition > 0) - { - // do we have enough space? if not, resize - if (m_outBuffer->m_buffer.size() < (m_outBuffer->m_writePosition + m_secondaryOutBuffer->m_writePosition)) - m_outBuffer->m_buffer.resize(m_outBuffer->m_writePosition + m_secondaryOutBuffer->m_writePosition); - - memcpy(&(m_outBuffer->m_buffer[m_outBuffer->m_writePosition]), &(m_secondaryOutBuffer->m_buffer[0]), (m_secondaryOutBuffer->m_writePosition) * sizeof(m_secondaryOutBuffer->m_buffer[0])); - - m_outBuffer->m_writePosition += m_secondaryOutBuffer->m_writePosition; - m_secondaryOutBuffer->m_writePosition = 0; - } - - std::shared_ptr ptr = shared(); - // if there is any data to write, do so immediately - if (m_outBuffer->m_writePosition > 0) - m_socket.async_write_some(boost::asio::buffer(m_outBuffer->m_buffer, m_outBuffer->m_writePosition), - make_custom_alloc_handler(m_allocator, - [ptr](const boost::system::error_code & error, size_t length) { ptr->OnWriteComplete(error, length);})); - else - m_writeState = WriteState::Idle; - } -} diff --git a/src/shared/Util/Util.cpp b/src/shared/Util/Util.cpp index 944442043ab..fc451e3841d 100644 --- a/src/shared/Util/Util.cpp +++ b/src/shared/Util/Util.cpp @@ -303,7 +303,7 @@ bool IsIPAddress(char const* ipaddress) // Let the big boys do it. // Drawback: all valid ip address formats are recognized e.g.: 12.23,121234,0xABCD) boost::system::error_code ec; - boost::asio::ip::address::from_string(ipaddress, ec); + boost::asio::ip::make_address(ipaddress, ec); return ec.value() == 0; }