First test version with network timeout. Only activity timeout and global timeout, no game admin timeout yet. Set to test values (will disconnect rapidly).

Modified method for init timeout (if session cannot be established) - now using one non-modifiable timer for each session, and an additional timer which is reset whenever session data is received.
This commit is contained in:
lotodore
2008-03-04 23:47:45 +00:00
parent 6d7e6d9a94
commit 9f0d204f56
21 changed files with 158 additions and 53 deletions
+10
View File
@@ -25,6 +25,7 @@
#include <net/receivebuffer.h>
#include <string>
#include <boost/thread.hpp>
#include <core/boost/timers.hpp>
#define INVALID_SESSION 0
#define SESSION_ID_INIT INVALID_SESSION
@@ -60,6 +61,12 @@ public:
ReceiveBuffer &GetReceiveBuffer();
void ResetActivityTimer();
unsigned GetActivityTimerElapsedSec() const;
bool HasActivityNoticeBeenSent() const;
void MarkActivityNotice();
unsigned GetAutoDisconnectTimerElapsedSec() const;
private:
SOCKET m_sockfd;
const SessionId m_id;
@@ -67,6 +74,9 @@ private:
std::string m_clientAddr;
ReceiveBuffer m_receiveBuffer;
bool m_readyFlag;
boost::timers::portable::microsec_timer m_activityTimer;
bool m_activityTimeoutNoticeSent;
boost::timers::portable::microsec_timer m_autoDisconnectTimer;
mutable boost::mutex m_dataMutex;
};