Use boost::asio timer callbacks instead of self-made ones. There are still some termination issues (terminating a network game will result in a crash). However, it should be quite effective now with a large number of users.

This commit is contained in:
lotodore
2009-06-01 19:49:16 +00:00
parent cee2d787d0
commit 47648392fb
7 changed files with 124 additions and 146 deletions
+2 -9
View File
@@ -53,6 +53,7 @@ public:
virtual ~ServerLobbyThread();
void Init(const std::string &pwd, const std::string &logDir);
virtual void SignalTermination();
void AddConnection(boost::shared_ptr<boost::asio::ip::tcp::socket> sock);
void ReAddSession(SessionWrapper session, int reason);
@@ -126,10 +127,8 @@ protected:
void HandleNetPacketJoinGame(SessionWrapper session, const NetPacketJoinGame &tmpPacket);
void EstablishSession(SessionWrapper session);
void RequestPlayerAvatar(SessionWrapper session);
void NewSessionLoop();
void TimerRemoveGame();
void TimerRemovePlayer();
void ResubscribeLobbyMsgLoop();
void TimerUpdateClientAvatarLock();
void TimerCheckSessionTimeouts();
void TimerCleanupAvatarCache();
@@ -173,12 +172,9 @@ protected:
private:
boost::shared_ptr<boost::asio::io_service> m_ioService;
boost::shared_ptr<boost::asio::io_service::work> m_work;
TimerManager m_timerManager;
SessionQueue m_sessionQueue;
mutable boost::mutex m_sessionQueueMutex;
SessionManager m_sessionManager;
SessionManager m_gameSessionManager;
@@ -194,9 +190,6 @@ private:
PlayerDataMap m_computerPlayers;
mutable boost::mutex m_computerPlayersMutex;
SessionIdList m_resubscribeList;
mutable boost::mutex m_resubscribeListMutex;
RegexMap m_banPlayerNameMap;
IPAddressMap m_banIPAddressMap;
unsigned m_curBanId;