Fixed design problem: Thread objects can now be created in any context.

Sender thread output queue is now limited.
Server thread now terminates correctly.
Now cloning packets when sending them to multiple recipients.
Fixed one thread issue - GameStart still needs to be made thread safe.
This commit is contained in:
lotodore
2007-03-20 11:56:30 +00:00
parent 53c4af95c8
commit 804c7eaaa2
12 changed files with 160 additions and 55 deletions
+9
View File
@@ -22,6 +22,7 @@
#define _NETPACKET_H_
#include <string>
#include <boost/shared_ptr.hpp>
#include <net/socket_helper.h>
#define MAX_PACKET_SIZE 256
@@ -75,6 +76,8 @@ class NetPacket
public:
virtual ~NetPacket();
virtual boost::shared_ptr<NetPacket> Clone() const = 0;
virtual void SetData(const NetPacketHeader *p) = 0;
virtual const NetPacketHeader *GetData() const = 0;
@@ -90,6 +93,8 @@ public:
NetPacketInit(u_int32_t value);
virtual ~NetPacketInit();
virtual boost::shared_ptr<NetPacket> Clone() const;
virtual const NetPacketHeader *GetData() const;
virtual void SetData(const NetPacketHeader *p);
@@ -109,6 +114,8 @@ public:
NetPacketInitAck(u_int32_t value);
virtual ~NetPacketInitAck();
virtual boost::shared_ptr<NetPacket> Clone() const;
virtual const NetPacketHeader *GetData() const;
virtual void SetData(const NetPacketHeader *p);
@@ -128,6 +135,8 @@ public:
NetPacketGameStart(u_int32_t value);
virtual ~NetPacketGameStart();
virtual boost::shared_ptr<NetPacket> Clone() const;
virtual const NetPacketHeader *GetData() const;
virtual void SetData(const NetPacketHeader *p);