Core/NetworkIO: Set non blocking mode on sockets properly

This commit is contained in:
Shauren committed 2014-09-12 19:34:26 +02:00
1 parent dcba0106d6
commit 6dff6b7425
1 file changed
+4 -5
+4 -5
View File
@@ -32,8 +32,6 @@ public:
_acceptor(ioService, tcp::endpoint(boost::asio::ip::address::from_string(bindIp), port)),
_socket(ioService)
{
boost::system::error_code error;
_acceptor.non_blocking(true, error);
}
template <class T>
@@ -47,12 +45,13 @@ public:
{
try
{
// this-> is required here to fix an segmentation fault in gcc 4.7.2 - reason is lambdas in a templated class
mgrHandler(std::move(this->_socket));
_socket.non_blocking(true);
mgrHandler(std::move(_socket));
}
catch (boost::system::system_error const& err)
{
TC_LOG_INFO("network", "Failed to retrieve client's remote address %s", err.what());
TC_LOG_INFO("network", "Failed to initialize client's socket %s", err.what());
}
}