diff --git a/src/Nazara/Network/ENetPeer.cpp b/src/Nazara/Network/ENetPeer.cpp index 2a9adfcbf..5ce92a1e4 100644 --- a/src/Nazara/Network/ENetPeer.cpp +++ b/src/Nazara/Network/ENetPeer.cpp @@ -287,12 +287,15 @@ namespace Nz UInt32 serviceTime = m_host->GetServiceTime(); auto it = m_sentReliableCommands.begin(); - for (; it != m_sentReliableCommands.end(); ++it) + for (; it != m_sentReliableCommands.end();) { OutgoingCommand& command = *it; if (ENetTimeDifference(serviceTime, command.sentTime) < command.roundTripTimeout) + { + ++it; continue; + } if (m_earliestTimeout == 0 || ENetTimeLess(command.sentTime, m_earliestTimeout)) m_earliestTimeout = command.sentTime; @@ -315,6 +318,7 @@ namespace Nz command.roundTripTimeoutLimit = m_timeoutLimit * command.roundTripTimeout; m_outgoingReliableCommands.emplace_front(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) && @@ -326,8 +330,6 @@ namespace Nz }*/ } - m_sentReliableCommands.erase(m_sentReliableCommands.begin(), it); - return false; }