mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Core/Network: Fix some possible exceptions on socket.close()
Ref #12634
This commit is contained in:
@@ -161,7 +161,7 @@ void AuthSession::AsyncReadHeader()
|
||||
}
|
||||
else
|
||||
{
|
||||
_socket.close();
|
||||
CloseSocket();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -176,7 +176,7 @@ void AuthSession::AsyncReadData(bool (AuthSession::*handler)(), size_t dataSize,
|
||||
{
|
||||
if (!(*this.*handler)())
|
||||
{
|
||||
_socket.close();
|
||||
CloseSocket();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ void AuthSession::AsyncReadData(bool (AuthSession::*handler)(), size_t dataSize,
|
||||
}
|
||||
else
|
||||
{
|
||||
_socket.close();
|
||||
CloseSocket();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -195,7 +195,7 @@ void AuthSession::AsyncWrite(std::size_t length)
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
_socket.close();
|
||||
CloseSocket();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -935,3 +935,11 @@ void AuthSession::SetVSFields(const std::string& rI)
|
||||
OPENSSL_free(v_hex);
|
||||
OPENSSL_free(s_hex);
|
||||
}
|
||||
|
||||
void AuthSession::CloseSocket()
|
||||
{
|
||||
boost::system::error_code socketError;
|
||||
_socket.close(socketError);
|
||||
if (socketError)
|
||||
TC_LOG_DEBUG("server.authserver", "Account '%s' errored when closing socket: %i (%s)", _login.c_str(), socketError.value(), socketError.message());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user