Core/Networking: Set SO_REUSEADDR on *nix platforms

This commit is contained in:
jackpoz authored and Ovahlord committed 2020-05-06 00:01:17 +02:00
1 parent 9d0bfc0c56
commit 03609506ae
2 files changed
+13

No files matched your search

@@ -83,6 +83,15 @@ public:
return false;
}
#if TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS
_acceptor.set_option(boost::asio::ip::tcp::acceptor::reuse_address(true), errorCode);
if (errorCode)
{
TC_LOG_INFO("network", "Failed to set reuse_address option on acceptor %s", errorCode.message().c_str());
return false;
}
#endif
_acceptor.bind(_endpoint, errorCode);
if (errorCode)
{
+4
View File
@@ -29,6 +29,10 @@ void TCSoapThread(const std::string& host, uint16 port)
soap_set_imode(&soap, SOAP_C_UTFSTRING);
soap_set_omode(&soap, SOAP_C_UTFSTRING);
#if TRINITY_PLATFORM != TRINITY_PLATFORM_WINDOWS
soap.bind_flags = SO_REUSEADDR;
#endif
// check every 3 seconds if world ended
soap.accept_timeout = 3;
soap.recv_timeout = 5;