1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 20:43:04 +01:00

Fix corrupted tcp stream when pinging while sending packets

Don't push network packets to the front of the queue if the frist packet is only partially transmitted. They are now inserted at the second
position instead.
This commit is contained in:
Manuel Vögele
2016-09-13 00:59:22 +02:00
committed by Ted John
parent 7cecdeba3f
commit 73b7f3c9f4

View File

@@ -121,7 +121,17 @@ void NetworkConnection::QueuePacket(std::unique_ptr<NetworkPacket> packet, bool
packet->size = (uint16)packet->data->size();
if (front)
{
_outboundPackets.push_front(std::move(packet));
// If the first packet was already partially sent add new packet to second position
if (_outboundPackets.size() > 0 && _outboundPackets.front()->transferred > 0)
{
auto it = _outboundPackets.begin();
it++; // Second position
_outboundPackets.insert(it, std::move(packet));
}
else
{
_outboundPackets.push_front(std::move(packet));
}
}
else
{