You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking at WorldSocket::Update i notice 2 suspicious things happening inside while loop;
At the beginning of while loop we have this piece of code. What will happend if the very first packet in the queue (event after compression) is still to big for a buffer? Do i understand correctly that we will enqueue an empty buffer?
// Flush current buffer if too small for next packet
if (buffer.GetRemainingSpace() < packetSize + sizeof(PacketHeader))
{
QueuePacket(std::move(buffer));
buffer.Resize(_sendBufferSize);
}
The second thing where possible out-of-order sending can happend is below in the else statement
else // single packet larger than _sendBufferSize
{
MessageBuffer packetBuffer(packetSize + sizeof(PacketHeader));
WritePacketToBuffer(*queued, packetBuffer);
QueuePacket(std::move(packetBuffer));
}
Let's imagine we have the sequence of packets of different sizes queued. Size of the imagine packet on the right.
A - 5, B - 35, C - 17, D - 50k, E - 150
The first 3 packets (A, B, C) will be pushed to buffer because their sizes is smaller than _sendBufferSize. Then we dequeue packet 'D' whose size is larger, we will create a separate MessageBuffer, write it to it and queue it. After we take packet 'E' and also write it to buffer. After the loop we queue the buffer. And after that our queue will look like this
D - A - B - C - E.
D is the first because we queued it before the buffer.
Idk if this is a real-case scenario considering compression. possible solution would be adding
if (buffer.GetActiveSize() > 0)
{
QueuePacket(std::move(buffer));
buffer.Resize(_sendBufferSize);
}
Description
Looking at WorldSocket::Update i notice 2 suspicious things happening inside while loop;
Let's imagine we have the sequence of packets of different sizes queued. Size of the imagine packet on the right.
A - 5, B - 35, C - 17, D - 50k, E - 150
The first 3 packets (A, B, C) will be pushed to buffer because their sizes is smaller than _sendBufferSize. Then we dequeue packet 'D' whose size is larger, we will create a separate MessageBuffer, write it to it and queue it. After we take packet 'E' and also write it to buffer. After the loop we queue the buffer. And after that our queue will look like this
D - A - B - C - E.
D is the first because we queued it before the buffer.
Idk if this is a real-case scenario considering compression. possible solution would be adding
Expected behaviour
None
Steps to reproduce the problem
Check the code
Branch
3.3.5
TC rev. hash/commit
commit dc22160
Operating system
Windows 10 x64
Custom changes
None
The text was updated successfully, but these errors were encountered: