mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 05:21:29 +00:00
[Netcode] Adjust first packet for compress flag (#2326)
When a packet was over max_raw_size and zlib failed to compress the first packet chunk then the final output would be 513 bytes which exceeded m_max_packet_size of 512. This occured because the first packet chunk used sublen without adjusting for the new_length + 1 compression flag added in Compress(). When the packet failed to compress then it was already at its max. After the first packet, chunk sizes are calculated using max_raw_size which already accounted for the compress flag. (From #979) This should fix #2325
This commit is contained in:
parent
7d2f88325a
commit
c847e3da86
@ -1394,7 +1394,7 @@ void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id,
|
||||
first_header.total_size = (uint32_t)HostToNetwork((uint32_t)length);
|
||||
|
||||
size_t used = 0;
|
||||
size_t sublen = m_max_packet_size - m_crc_bytes - DaybreakReliableFragmentHeader::size();
|
||||
size_t sublen = m_max_packet_size - m_crc_bytes - DaybreakReliableFragmentHeader::size() - 1; // -1 for compress flag
|
||||
DynamicPacket first_packet;
|
||||
first_packet.PutSerialize(0, first_header);
|
||||
first_packet.PutData(DaybreakReliableFragmentHeader::size(), (char*)p.Data() + used, sublen);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user