Network/ENetPeer: Fix packets not being resend after timeout sometimes
This commit is contained in:
parent
1917a0e8dd
commit
a4fe005e3b
|
|
@ -287,12 +287,15 @@ namespace Nz
|
||||||
UInt32 serviceTime = m_host->GetServiceTime();
|
UInt32 serviceTime = m_host->GetServiceTime();
|
||||||
|
|
||||||
auto it = m_sentReliableCommands.begin();
|
auto it = m_sentReliableCommands.begin();
|
||||||
for (; it != m_sentReliableCommands.end(); ++it)
|
for (; it != m_sentReliableCommands.end();)
|
||||||
{
|
{
|
||||||
OutgoingCommand& command = *it;
|
OutgoingCommand& command = *it;
|
||||||
|
|
||||||
if (ENetTimeDifference(serviceTime, command.sentTime) < command.roundTripTimeout)
|
if (ENetTimeDifference(serviceTime, command.sentTime) < command.roundTripTimeout)
|
||||||
|
{
|
||||||
|
++it;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (m_earliestTimeout == 0 || ENetTimeLess(command.sentTime, m_earliestTimeout))
|
if (m_earliestTimeout == 0 || ENetTimeLess(command.sentTime, m_earliestTimeout))
|
||||||
m_earliestTimeout = command.sentTime;
|
m_earliestTimeout = command.sentTime;
|
||||||
|
|
@ -315,6 +318,7 @@ namespace Nz
|
||||||
command.roundTripTimeoutLimit = m_timeoutLimit * command.roundTripTimeout;
|
command.roundTripTimeoutLimit = m_timeoutLimit * command.roundTripTimeout;
|
||||||
|
|
||||||
m_outgoingReliableCommands.emplace_front(std::move(command));
|
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
|
// Okay this should just never procs, I don't see how it would be possible
|
||||||
/*if (currentCommand == enet_list_begin(&peer->sentReliableCommands) &&
|
/*if (currentCommand == enet_list_begin(&peer->sentReliableCommands) &&
|
||||||
|
|
@ -326,8 +330,6 @@ namespace Nz
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sentReliableCommands.erase(m_sentReliableCommands.begin(), it);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue