diff --git a/src/net/common/clientstate.cpp b/src/net/common/clientstate.cpp index 40fe0aa7..a06f51cf 100644 --- a/src/net/common/clientstate.cpp +++ b/src/net/common/clientstate.cpp @@ -1011,7 +1011,7 @@ ClientStateWaitEnterLogin::Exit(boost::shared_ptr client) } void -ClientStateWaitEnterLogin::HandlePacket(boost::shared_ptr client, boost::shared_ptr tmpPacket) +ClientStateWaitEnterLogin::HandlePacket(boost::shared_ptr /*client*/, boost::shared_ptr tmpPacket) { if (tmpPacket->GetMsg()->present == PokerTHMessage_PR_errorMessage) { // Server reported an error. diff --git a/src/net/common/serverlobbythread.cpp b/src/net/common/serverlobbythread.cpp index 2c9f02a5..8964beb6 100644 --- a/src/net/common/serverlobbythread.cpp +++ b/src/net/common/serverlobbythread.cpp @@ -184,7 +184,7 @@ ServerLobbyThread::ServerLobbyThread(GuiInterface &gui, ServerMode mode, ServerI AvatarManager &avatarManager, boost::shared_ptr ioService) : m_ioService(ioService), m_authContext(NULL), m_gui(gui), m_ircBotCb(ircBotCb), m_avatarManager(avatarManager), m_mode(mode), m_serverConfig(serverConfig), m_curGameId(0), m_curUniquePlayerId(0), m_curSessionId(INVALID_SESSION + 1), - m_statDataChanged(false), m_removeGameTimer(*ioService), m_removePlayerTimer(*ioService), + m_statDataChanged(false), m_removeGameTimer(*ioService), m_saveStatisticsTimer(*ioService), m_loginLockTimer(*ioService), m_startTime(boost::posix_time::second_clock::local_time()) { @@ -536,8 +536,7 @@ ServerLobbyThread::GetPlayerNameFromId(unsigned playerId) const void ServerLobbyThread::RemovePlayer(unsigned playerId, unsigned errorCode) { - boost::mutex::scoped_lock lock(m_removePlayerListMutex); - m_removePlayerList.push_back(RemovePlayerList::value_type(playerId, errorCode)); + m_ioService->post(boost::bind(&ServerLobbyThread::InternalRemovePlayer, shared_from_this(), playerId, errorCode)); } void @@ -765,12 +764,6 @@ ServerLobbyThread::RegisterTimers() m_removeGameTimer.async_wait( boost::bind( &ServerLobbyThread::TimerRemoveGame, shared_from_this(), boost::asio::placeholders::error)); - // Remove inactive/kicked players. - m_removePlayerTimer.expires_from_now( - boost::posix_time::milliseconds(SERVER_REMOVE_PLAYER_INTERVAL_MSEC)); - m_removePlayerTimer.async_wait( - boost::bind( - &ServerLobbyThread::TimerRemovePlayer, shared_from_this(), boost::asio::placeholders::error)); // Update the statistics file. m_saveStatisticsTimer.expires_from_now( boost::posix_time::seconds(SERVER_SAVE_STATISTICS_INTERVAL_SEC)); @@ -789,7 +782,6 @@ void ServerLobbyThread::CancelTimers() { m_removeGameTimer.cancel(); - m_removePlayerTimer.cancel(); m_saveStatisticsTimer.cancel(); m_loginLockTimer.cancel(); } @@ -1643,31 +1635,6 @@ ServerLobbyThread::TimerRemoveGame(const boost::system::error_code &ec) } } -void -ServerLobbyThread::TimerRemovePlayer(const boost::system::error_code &ec) -{ - if (!ec) { - boost::mutex::scoped_lock lock(m_removePlayerListMutex); - - if (!m_removePlayerList.empty()) { - RemovePlayerList::iterator i = m_removePlayerList.begin(); - RemovePlayerList::iterator end = m_removePlayerList.end(); - - while (i != end) { - InternalRemovePlayer(i->first, i->second); - ++i; - } - m_removePlayerList.clear(); - } - // Restart timer - m_removePlayerTimer.expires_from_now( - boost::posix_time::milliseconds(SERVER_REMOVE_PLAYER_INTERVAL_MSEC)); - m_removePlayerTimer.async_wait( - boost::bind( - &ServerLobbyThread::TimerRemovePlayer, shared_from_this(), boost::asio::placeholders::error)); - } -} - void ServerLobbyThread::TimerUpdateClientLoginLock(const boost::system::error_code &ec) { diff --git a/src/net/serverlobbythread.h b/src/net/serverlobbythread.h index 39739947..238a63cf 100644 --- a/src/net/serverlobbythread.h +++ b/src/net/serverlobbythread.h @@ -215,9 +215,6 @@ private: RemoveGameList m_removeGameList; mutable boost::mutex m_removeGameListMutex; - RemovePlayerList m_removePlayerList; - mutable boost::mutex m_removePlayerListMutex; - PlayerDataMap m_computerPlayers; mutable boost::mutex m_computerPlayersMutex; @@ -247,7 +244,6 @@ private: boost::shared_ptr m_database; boost::asio::deadline_timer m_removeGameTimer; - boost::asio::deadline_timer m_removePlayerTimer; boost::asio::deadline_timer m_saveStatisticsTimer; boost::asio::deadline_timer m_loginLockTimer;