Added helper class for receiving data. Modified sender thread to support sending partial packets. Prepared abstractions for server state machine.

This commit is contained in:
lotodore
2007-03-13 02:23:12 +00:00
parent 29b29ec42e
commit f5289a6fcf
24 changed files with 508 additions and 70 deletions
+9 -5
View File
@@ -23,21 +23,20 @@
#include <core/thread.h>
#include <net/socket_helper.h>
#include <net/netpacket.h>
#include <deque>
#include <boost/shared_ptr.hpp>
class ClientData;
class NetPacket;
class NetCallback;
class SenderThread : public Thread
{
public:
SenderThread();
SenderThread(NetCallback &cb);
virtual ~SenderThread();
// Set the socket from which to receive data.
// TODO: Add error callback.
// Set the socket used to send data.
void Init(SOCKET socket);
void Send(boost::shared_ptr<NetPacket> packet);
@@ -53,6 +52,11 @@ private:
std::deque<boost::shared_ptr<NetPacket> > m_outBuf;
mutable boost::mutex m_outBufMutex;
char m_tmpOutBuf[MAX_PACKET_SIZE];
unsigned m_tmpOutBufSize;
NetCallback &m_callback;
};
#endif