Handle asio::error::eof to properly log client initiated disconnects

This commit is contained in:
loonycyborg 2016-06-25 03:19:17 +03:00
parent e33f622377
commit 8710ec2bbc

View File

@ -165,7 +165,10 @@ std::string client_address(socket_ptr socket)
bool check_error(const boost::system::error_code& error, socket_ptr socket)
{
if(error) {
ERR_SERVER << client_address(socket) << "\t" << error.message() << "\n";
if(error == boost::asio::error::eof)
LOG_SERVER << client_address(socket) << "\tconnection closed\n";
else
ERR_SERVER << client_address(socket) << "\t" << error.message() << "\n";
return true;
}
return false;