Fixing server exception when shutting down a socket which was already closed.
This commit is contained in:
@@ -371,7 +371,9 @@ ServerLobbyThread::CloseSession(boost::shared_ptr<SessionData> session)
|
|||||||
// Update stats (if needed).
|
// Update stats (if needed).
|
||||||
UpdateStatisticsNumberOfPlayers();
|
UpdateStatisticsNumberOfPlayers();
|
||||||
session->SetGame(boost::shared_ptr<ServerGame>());
|
session->SetGame(boost::shared_ptr<ServerGame>());
|
||||||
session->GetAsioSocket()->shutdown(boost::asio::ip::tcp::socket::shutdown_receive);
|
// Ignore error when shutting down the socket.
|
||||||
|
boost::system::error_code ec;
|
||||||
|
session->GetAsioSocket()->shutdown(boost::asio::ip::tcp::socket::shutdown_receive, ec);
|
||||||
// Close this session after send.
|
// Close this session after send.
|
||||||
GetSender().SetCloseAfterSend(session);
|
GetSender().SetCloseAfterSend(session);
|
||||||
// Cancel all timers of the session.
|
// Cancel all timers of the session.
|
||||||
|
|||||||
Reference in New Issue
Block a user