Adopting changes from asio branch. Currently broken.

This commit is contained in:
lotodore
2009-05-04 21:11:29 +00:00
parent a65934e2a5
commit 60b5d45c53
23 changed files with 539 additions and 421 deletions
+8 -2
View File
@@ -23,13 +23,13 @@
typedef unsigned SessionId;
#include <boost/asio.hpp>
#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>
#include <boost/asio.hpp>
#define INVALID_SESSION 0
#define SESSION_ID_INIT INVALID_SESSION
@@ -42,10 +42,15 @@ class SessionData
public:
enum State { Init, ReceivingAvatar, Established, Game };
SessionData(SOCKET sockfd, SessionId id, boost::shared_ptr<SenderInterface> sender, SessionDataCallback &cb, boost::asio::io_service &ioService);
SessionData(boost::shared_ptr<boost::asio::ip::tcp::socket> sock, SessionId id,
boost::shared_ptr<SenderInterface> sender, SessionDataCallback &cb);
~SessionData();
SessionId GetId() const;
unsigned GetGameId() const;
void SetGameId(unsigned gameId);
State GetState() const;
void SetState(State state);
@@ -77,6 +82,7 @@ public:
private:
boost::shared_ptr<boost::asio::ip::tcp::socket> m_socket;
const SessionId m_id;
unsigned m_gameId;
State m_state;
std::string m_clientAddr;
ReceiveBuffer m_receiveBuffer;