From 7b6d5d75f6747c56999dd6a07e01494e1d7d6fd6 Mon Sep 17 00:00:00 2001 From: Emagi Date: Wed, 26 Mar 2025 12:28:44 -0400 Subject: [PATCH] reusing EQStream buffer for WritePacket --- source/common/EQStream.cpp | 5 ++--- source/common/EQStream.h | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/source/common/EQStream.cpp b/source/common/EQStream.cpp index bbaf3a9..fef52ad 100644 --- a/source/common/EQStream.cpp +++ b/source/common/EQStream.cpp @@ -1503,7 +1503,6 @@ void EQStream::WritePacket(int eq_fd, EQProtocolPacket *p) { uint32 length = 0; sockaddr_in address; -unsigned char tmpbuffer[2048]; address.sin_family = AF_INET; address.sin_addr.s_addr=remote_ip; address.sin_port=remote_port; @@ -1523,8 +1522,8 @@ unsigned char tmpbuffer[2048]; if (p->opcode!=OP_SessionRequest && p->opcode!=OP_SessionResponse) { if (compressed) { BytesWritten -= p->size; - uint32 newlen=EQProtocolPacket::Compress(buffer,length,tmpbuffer,2048); - memcpy(buffer,tmpbuffer,newlen); + uint32 newlen=EQProtocolPacket::Compress(buffer,length,write_buffer,2048); + memcpy(buffer,write_buffer,newlen); length=newlen; BytesWritten += newlen; } diff --git a/source/common/EQStream.h b/source/common/EQStream.h index 3ec6028..3ce45a8 100644 --- a/source/common/EQStream.h +++ b/source/common/EQStream.h @@ -151,7 +151,9 @@ class EQStream { uint8 app_opcode_size; EQStreamType StreamType; bool compressed,encoded; - + + unsigned char write_buffer[2048]; + uint32 retransmittimer; uint32 retransmittimeout; //uint32 buffer_len;