Fixed one thread per session implementation. Kind of. Still seems to have a handle leak on Windows. However, it does not scale at all and needs to be reverted. It won't even handle 500 players with 500 games on a dual core high end machine.

This commit is contained in:
lotodore
2009-01-11 20:12:26 +00:00
parent 4f7cf0bdb2
commit 29061b661c
11 changed files with 155 additions and 34 deletions
+6 -5
View File
@@ -21,8 +21,11 @@
#ifndef _SESSIONDATA_H_
#define _SESSIONDATA_H_
typedef unsigned SessionId;
#include <net/socket_helper.h>
#include <net/receivebuffer.h>
#include <net/sessiondatacallback.h>
#include <string>
#include <boost/thread.hpp>
#include <third_party/boost/timers.hpp>
@@ -31,17 +34,14 @@
#define SESSION_ID_INIT INVALID_SESSION
#define SESSION_ID_GENERIC 0xFFFFFFFF
typedef unsigned SessionId;
class SenderThread;
class SenderInterface;
class SenderCallback;
class SessionData
{
public:
enum State { Init, ReceivingAvatar, Established, Game };
SessionData(SOCKET sockfd, SessionId id, SenderCallback &cb);
SessionData(SOCKET sockfd, SessionId id, boost::shared_ptr<SenderInterface> sender, SessionDataCallback &cb);
~SessionData();
SessionId GetId() const;
@@ -80,7 +80,8 @@ private:
boost::timers::portable::microsec_timer m_activityTimer;
bool m_activityTimeoutNoticeSent;
boost::timers::portable::microsec_timer m_autoDisconnectTimer;
boost::shared_ptr<SenderThread> m_sender;
boost::shared_ptr<SenderInterface> m_sender;
SessionDataCallback &m_callback;
mutable boost::mutex m_dataMutex;
};