Network/ENetPeer: Fix enet stuff

This commit is contained in:
Jérôme Leclercq 2018-07-17 09:56:30 +02:00
parent f2487bbcba
commit 6dfc866a4d
1 changed files with 7 additions and 8 deletions

View File

@ -286,6 +286,8 @@ namespace Nz
{ {
UInt32 serviceTime = m_host->GetServiceTime(); UInt32 serviceTime = m_host->GetServiceTime();
auto insertPosition = m_outgoingReliableCommands.begin();
auto it = m_sentReliableCommands.begin(); auto it = m_sentReliableCommands.begin();
for (; it != m_sentReliableCommands.end();) for (; it != m_sentReliableCommands.end();)
{ {
@ -317,17 +319,14 @@ namespace Nz
command.roundTripTimeout = m_roundTripTime + 4 * m_roundTripTimeVariance; command.roundTripTimeout = m_roundTripTime + 4 * m_roundTripTimeVariance;
command.roundTripTimeoutLimit = m_timeoutLimit * command.roundTripTimeout; 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); it = m_sentReliableCommands.erase(it);
// Okay this should just never procs, I don't see how it would be possible if (it == m_sentReliableCommands.begin() && !m_sentReliableCommands.empty())
/*if (currentCommand == enet_list_begin(&peer->sentReliableCommands) &&
!enet_list_empty(&peer->sentReliableCommands))
{ {
outgoingCommand = (ENetOutgoingCommand *) currentCommand; OutgoingCommand& outgoingCommand = *it;
m_nextTimeout = outgoingCommand.sentTime + outgoingCommand.roundTripTimeout;
peer->nextTimeout = outgoingCommand->sentTime + outgoingCommand->roundTripTimeout; }
}*/
} }
return false; return false;