From 6dfc866a4d324185a6b209fc7eb048116e5e9d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Leclercq?= Date: Tue, 17 Jul 2018 09:56:30 +0200 Subject: [PATCH] Network/ENetPeer: Fix enet stuff --- src/Nazara/Network/ENetPeer.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Nazara/Network/ENetPeer.cpp b/src/Nazara/Network/ENetPeer.cpp index a26423bb4..fbae65e14 100644 --- a/src/Nazara/Network/ENetPeer.cpp +++ b/src/Nazara/Network/ENetPeer.cpp @@ -286,6 +286,8 @@ namespace Nz { UInt32 serviceTime = m_host->GetServiceTime(); + auto insertPosition = m_outgoingReliableCommands.begin(); + auto it = m_sentReliableCommands.begin(); for (; it != m_sentReliableCommands.end();) { @@ -317,17 +319,14 @@ namespace Nz command.roundTripTimeout = m_roundTripTime + 4 * m_roundTripTimeVariance; command.roundTripTimeoutLimit = m_timeoutLimit * command.roundTripTimeout; - m_outgoingReliableCommands.emplace_front(std::move(command)); + m_outgoingReliableCommands.insert(insertPosition, std::move(command)); it = m_sentReliableCommands.erase(it); - // Okay this should just never procs, I don't see how it would be possible - /*if (currentCommand == enet_list_begin(&peer->sentReliableCommands) && - !enet_list_empty(&peer->sentReliableCommands)) + if (it == m_sentReliableCommands.begin() && !m_sentReliableCommands.empty()) { - outgoingCommand = (ENetOutgoingCommand *) currentCommand; - - peer->nextTimeout = outgoingCommand->sentTime + outgoingCommand->roundTripTimeout; - }*/ + OutgoingCommand& outgoingCommand = *it; + m_nextTimeout = outgoingCommand.sentTime + outgoingCommand.roundTripTimeout; + } } return false;