Canceling asio timers has bad semantics, and causes loads of trouble. Therefore, cancelled timers are simply marked as such, and the asio callback is silently ignored. This fixes several crashes, if players were removed from a game due to an error, because some timers were not cancelled. *sigh* This one took a lot of nerve.

This commit is contained in:
lotodore
2009-06-07 23:25:13 +00:00
parent a6146399d4
commit c8594e8e7b
10 changed files with 56 additions and 44 deletions
+11 -3
View File
@@ -46,7 +46,16 @@ ServerGame::ServerGame(ServerLobbyThread &lobbyThread, u_int32_t id, const strin
LOG_VERBOSE("Game object " << GetId() << " created.");
m_receiver.reset(new ReceiverHelper);
}
ServerGame::~ServerGame()
{
LOG_VERBOSE("Game object " << GetId() << " destructed.");
}
void
ServerGame::Init()
{
m_voteKickTimerId = GetLobbyThread().GetTimerManager().RegisterTimer(
SERVER_CHECK_VOTE_KICK_INTERVAL_MSEC,
boost::bind(&ServerGame::TimerVoteKick, this),
@@ -55,12 +64,11 @@ ServerGame::ServerGame(ServerLobbyThread &lobbyThread, u_int32_t id, const strin
SetState(SERVER_INITIAL_STATE::Instance());
}
ServerGame::~ServerGame()
void
ServerGame::Exit()
{
GetLobbyThread().GetTimerManager().UnregisterTimer(m_voteKickTimerId);
GetLobbyThread().GetTimerManager().UnregisterTimer(m_stateTimerId);
LOG_VERBOSE("Game object " << GetId() << " destructed.");
}
u_int32_t