Core/Networking: Set SO_REUSEADDR on *nix platforms

This commit is contained in:
jackpoz
2019-01-18 20:31:47 +01:00
parent 12852ddb30
commit 46f2595f51
2 changed files with 13 additions and 0 deletions

View File

@@ -84,6 +84,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)
{

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;