From dfe00abc5addd66dbf840d7e826690291f4afd93 Mon Sep 17 00:00:00 2001 From: Loic Blot Date: Sun, 29 Mar 2015 10:49:43 +0200 Subject: [PATCH] queued_commands must be a std::deque. RunCommandQueues needs to push packet on front, not back --- src/network/connection.cpp | 20 ++++++++------------ src/network/connection.h | 2 +- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/network/connection.cpp b/src/network/connection.cpp index d51324ed4..4440b8cc7 100644 --- a/src/network/connection.cpp +++ b/src/network/connection.cpp @@ -1063,14 +1063,14 @@ void UDPPeer::PutReliableSendCommand(ConnectionCommand &c, <<" processing reliable command for peer id: " << c.peer_id <<" data size: " << c.data.getSize() << std::endl); if (!processReliableSendCommand(c,max_packet_size)) { - channels[c.channelnum].queued_commands.push(c); + channels[c.channelnum].queued_commands.push_back(c); } } else { LOG(dout_con<getDesc() <<" Queueing reliable command for peer id: " << c.peer_id <<" data size: " << c.data.getSize() < 0) && (channels[i].queued_reliables.size() < maxtransfer) && - (commands_processed < maxcommands)) - { + (commands_processed < maxcommands)) { try { ConnectionCommand c = channels[i].queued_commands.front(); - channels[i].queued_commands.pop(); + channels[i].queued_commands.pop_front(); LOG(dout_con<getDesc() <<" processing queued reliable command "<(&peer) == 0) continue; - for(u16 i=0; i(&peer))->channels[i]; - if (channel->queued_commands.size() > 0) - { + if (channel->queued_commands.size() > 0) { return true; } } diff --git a/src/network/connection.h b/src/network/connection.h index 0aa63d4cf..9c920cc01 100644 --- a/src/network/connection.h +++ b/src/network/connection.h @@ -501,7 +501,7 @@ public: std::queue queued_reliables; //queue commands prior splitting to packets - std::queue queued_commands; + std::deque queued_commands; IncomingSplitBuffer incoming_splits;