Rewriting sender yet again to fit the new asio design. Polling for new send data is no longer needed, this also reduces lag.

This commit is contained in:
lotodore
2009-06-07 08:51:43 +00:00
parent 9e50969bdc
commit 5f3369432a
14 changed files with 187 additions and 269 deletions
+5 -16
View File
@@ -21,29 +21,24 @@
#ifndef _SENDERHELPER_H_
#define _SENDERHELPER_H_
#include <net/senderinterface.h>
#include <net/netpacket.h>
#include <net/sendercallback.h>
class SessionData;
class SendDataManager;
class SenderHelper : public SenderInterface
class SenderHelper
{
public:
SenderHelper(SenderCallback &cb, boost::shared_ptr<boost::asio::io_service> ioService);
virtual ~SenderHelper();
~SenderHelper();
virtual void Send(boost::shared_ptr<SessionData> session, boost::shared_ptr<NetPacket> packet);
virtual void Send(boost::shared_ptr<SessionData> session, const NetPacketList &packetList);
void Send(boost::shared_ptr<SessionData> session, boost::shared_ptr<NetPacket> packet);
void Send(boost::shared_ptr<SessionData> session, const NetPacketList &packetList);
virtual void Process();
virtual void SignalSessionTerminated(unsigned sessionId);
void SignalSessionTerminated(unsigned sessionId);
protected:
typedef std::list<unsigned> SessionIdList;
typedef std::map<SessionId, boost::shared_ptr<SendDataManager> > SendQueueMap;
private:
@@ -53,12 +48,6 @@ private:
SendQueueMap m_sendQueueMap;
mutable boost::mutex m_sendQueueMapMutex;
SessionIdList m_changedSessions;
mutable boost::mutex m_changedSessionsMutex;
SessionIdList m_removedSessions;
mutable boost::mutex m_removedSessionsMutex;
};
#endif