reusing EQStream buffer for WritePacket
This commit is contained in:
parent
61aec683b5
commit
7b6d5d75f6
@ -1503,7 +1503,6 @@ void EQStream::WritePacket(int eq_fd, EQProtocolPacket *p)
|
|||||||
{
|
{
|
||||||
uint32 length = 0;
|
uint32 length = 0;
|
||||||
sockaddr_in address;
|
sockaddr_in address;
|
||||||
unsigned char tmpbuffer[2048];
|
|
||||||
address.sin_family = AF_INET;
|
address.sin_family = AF_INET;
|
||||||
address.sin_addr.s_addr=remote_ip;
|
address.sin_addr.s_addr=remote_ip;
|
||||||
address.sin_port=remote_port;
|
address.sin_port=remote_port;
|
||||||
@ -1523,8 +1522,8 @@ unsigned char tmpbuffer[2048];
|
|||||||
if (p->opcode!=OP_SessionRequest && p->opcode!=OP_SessionResponse) {
|
if (p->opcode!=OP_SessionRequest && p->opcode!=OP_SessionResponse) {
|
||||||
if (compressed) {
|
if (compressed) {
|
||||||
BytesWritten -= p->size;
|
BytesWritten -= p->size;
|
||||||
uint32 newlen=EQProtocolPacket::Compress(buffer,length,tmpbuffer,2048);
|
uint32 newlen=EQProtocolPacket::Compress(buffer,length,write_buffer,2048);
|
||||||
memcpy(buffer,tmpbuffer,newlen);
|
memcpy(buffer,write_buffer,newlen);
|
||||||
length=newlen;
|
length=newlen;
|
||||||
BytesWritten += newlen;
|
BytesWritten += newlen;
|
||||||
}
|
}
|
||||||
|
@ -152,6 +152,8 @@ class EQStream {
|
|||||||
EQStreamType StreamType;
|
EQStreamType StreamType;
|
||||||
bool compressed,encoded;
|
bool compressed,encoded;
|
||||||
|
|
||||||
|
unsigned char write_buffer[2048];
|
||||||
|
|
||||||
uint32 retransmittimer;
|
uint32 retransmittimer;
|
||||||
uint32 retransmittimeout;
|
uint32 retransmittimeout;
|
||||||
//uint32 buffer_len;
|
//uint32 buffer_len;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user