Adding client for chat cleaner.

This commit is contained in:
lotodore
2009-08-14 18:56:45 +00:00
parent 3d65eaedd0
commit d068c6203d
7 changed files with 442 additions and 33 deletions
+2 -31
View File
@@ -25,6 +25,7 @@
#include <net/sendercallback.h>
#include <net/socket_helper.h>
#include <net/socket_msg.h>
#include <net/encodedpacket.h>
#include <core/loghelper.h>
#include <cstring>
#include <cassert>
@@ -38,35 +39,6 @@ using boost::asio::ip::tcp;
#define SEND_QUEUE_SIZE 10000000
#define SEND_LOG_INTERVAL_SEC 60
class EncodedPacket
{
public:
EncodedPacket(const unsigned char *data, unsigned size)
: m_size(size)
{
m_data = new unsigned char[size];
memcpy(m_data, data, size);
}
~EncodedPacket()
{
delete[] m_data;
}
unsigned GetSize() const
{
return m_size;
}
const unsigned char *GetData() const
{
return m_data;
}
private:
unsigned m_size;
unsigned char *m_data;
};
typedef std::list<boost::shared_ptr<EncodedPacket> > SendDataList;
@@ -234,8 +206,7 @@ void
SenderHelper::InternalStorePacket(SendDataManager &tmpManager, boost::shared_ptr<NetPacket> packet)
{
unsigned char buf[MAX_PACKET_SIZE];
asn_enc_rval_t e;
e = der_encode_to_buffer(&asn_DEF_PokerTHMessage, packet->GetMsg(), buf, MAX_PACKET_SIZE);
asn_enc_rval_t e = der_encode_to_buffer(&asn_DEF_PokerTHMessage, packet->GetMsg(), buf, MAX_PACKET_SIZE);
//cerr << "OUT:" << endl << packet->ToString() << endl;
if (e.encoded == -1)
LOG_ERROR("Failed to encode NetPacket: " << packet->GetMsg()->present);