Further paranoia changes to prevent timer callbacks from occurring in an uncontrolled state.
This commit is contained in:
@@ -1156,7 +1156,7 @@ ClientStateSynchronizeStart::TimerLoop(const boost::system::error_code& ec, boos
|
||||
}
|
||||
|
||||
void
|
||||
ClientStateSynchronizeStart::InternalHandlePacket(boost::shared_ptr<ClientThread> client, boost::shared_ptr<NetPacket> tmpPacket)
|
||||
ClientStateSynchronizeStart::InternalHandlePacket(boost::shared_ptr<ClientThread> /*client*/, boost::shared_ptr<NetPacket> tmpPacket)
|
||||
{
|
||||
if (tmpPacket->ToNetPacketGameStart())
|
||||
throw ClientException(__FILE__, __LINE__, ERR_NET_START_TIMEOUT, 0);
|
||||
@@ -1630,3 +1630,11 @@ ClientStateRunHand::ResetPlayerSets(Game &curGame)
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ClientStateFinal &
|
||||
ClientStateFinal::Instance()
|
||||
{
|
||||
static ClientStateFinal state;
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -444,6 +444,9 @@ ClientThread::Main()
|
||||
// Execute remaining ready handlers.
|
||||
m_ioService->reset();
|
||||
m_ioService->poll();
|
||||
// Set a state which does not do anything.
|
||||
SetState(CLIENT_FINAL_STATE::Instance());
|
||||
|
||||
} catch (const PokerTHException &e)
|
||||
{
|
||||
GetCallback().SignalNetClientError(e.GetErrorId(), e.GetOsErrorCode());
|
||||
|
||||
@@ -69,8 +69,7 @@ void
|
||||
ServerGame::Exit()
|
||||
{
|
||||
m_voteKickTimer.cancel();
|
||||
if (m_curState)
|
||||
m_curState->Exit(shared_from_this());
|
||||
SetState(ServerGameStateFinal::Instance());
|
||||
}
|
||||
|
||||
u_int32_t
|
||||
@@ -131,7 +130,7 @@ ServerGame::RemoveAllSessions()
|
||||
void
|
||||
ServerGame::TimerVoteKick(const boost::system::error_code &ec)
|
||||
{
|
||||
if (!ec)
|
||||
if (!ec && m_curState != &ServerGameStateFinal::Instance())
|
||||
{
|
||||
// Check whether someone should be kicked, or whether a vote kick should be aborted.
|
||||
// Only one vote kick can be active at a time.
|
||||
|
||||
@@ -1193,3 +1193,13 @@ ServerGameStateWaitPlayerAction::TimerTimeout(const boost::system::error_code &e
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ServerGameStateFinal ServerGameStateFinal::s_state;
|
||||
|
||||
ServerGameStateFinal &
|
||||
ServerGameStateFinal::Instance()
|
||||
{
|
||||
return s_state;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user