mirror of
https://github.com/ValveSoftware/GameNetworkingSockets.git
synced 2026-05-29 16:20:34 +00:00
Change "deadline < usecNow" to "deadline <= useNow" in several places.
We often schedule a wakeup *exactly* at the deadline. The OS almost never wakes us up at *exactly* the right time. But when it does, we can get confused, setting a deadline for the current time, and then not taking action on the thing we requested the wakeup call for, and setting the deadline again. P4:6653641
This commit is contained in:
@@ -2295,7 +2295,7 @@ void CConnectionTransportP2PBase::P2PTransportThink( SteamNetworkingMicroseconds
|
||||
// Check for reply timeout
|
||||
if ( m_usecEndToEndInFlightReplyTimeout )
|
||||
{
|
||||
if ( m_usecEndToEndInFlightReplyTimeout < usecNow )
|
||||
if ( m_usecEndToEndInFlightReplyTimeout <= usecNow )
|
||||
{
|
||||
m_usecEndToEndInFlightReplyTimeout = 0;
|
||||
++m_nReplyTimeoutsSinceLastRecv;
|
||||
|
||||
@@ -771,13 +771,13 @@ protected:
|
||||
inline static void ThinkInternal( TLinkStatsTracker *pThis, SteamNetworkingMicroseconds usecNow )
|
||||
{
|
||||
// Check for ending the current QoS interval
|
||||
if ( !pThis->m_bPassive && pThis->m_usecIntervalStart + k_usecSteamDatagramLinkStatsDefaultInterval < usecNow )
|
||||
if ( !pThis->m_bPassive && pThis->m_usecIntervalStart + k_usecSteamDatagramLinkStatsDefaultInterval <= usecNow )
|
||||
{
|
||||
pThis->UpdateInterval( usecNow );
|
||||
}
|
||||
|
||||
// Check for reply timeout.
|
||||
if ( pThis->m_usecInFlightReplyTimeout > 0 && pThis->m_usecInFlightReplyTimeout < usecNow )
|
||||
if ( pThis->m_usecInFlightReplyTimeout > 0 && pThis->m_usecInFlightReplyTimeout <= usecNow )
|
||||
{
|
||||
pThis->InFlightReplyTimeout( usecNow );
|
||||
}
|
||||
@@ -1027,7 +1027,7 @@ protected:
|
||||
{
|
||||
LinkStatsTrackerBase::ThinkInternal( pThis, usecNow );
|
||||
|
||||
if ( pThis->m_usecSpeedIntervalStart + k_usecSteamDatagramSpeedStatsDefaultInterval < usecNow )
|
||||
if ( pThis->m_usecSpeedIntervalStart + k_usecSteamDatagramSpeedStatsDefaultInterval <= usecNow )
|
||||
{
|
||||
pThis->UpdateSpeedInterval( usecNow );
|
||||
}
|
||||
|
||||
@@ -422,17 +422,17 @@ int LinkStatsTrackerBase::GetStatsSendNeed( SteamNetworkingMicroseconds usecNow
|
||||
// Message already in flight?
|
||||
if ( m_pktNumInFlight == 0 && !m_bPassive )
|
||||
{
|
||||
if ( m_usecPeerAckedInstaneous + k_usecLinkStatsInstantaneousReportInterval < usecNow && BCheckHaveDataToSendInstantaneous( usecNow ) )
|
||||
if ( m_usecPeerAckedInstaneous + k_usecLinkStatsInstantaneousReportInterval <= usecNow && BCheckHaveDataToSendInstantaneous( usecNow ) )
|
||||
{
|
||||
if ( m_usecPeerAckedInstaneous + k_usecLinkStatsInstantaneousReportMaxInterval < usecNow )
|
||||
if ( m_usecPeerAckedInstaneous + k_usecLinkStatsInstantaneousReportMaxInterval <= usecNow )
|
||||
nResult |= k_nSendStats_Instantanous_Due;
|
||||
else
|
||||
nResult |= k_nSendStats_Instantanous_Ready;
|
||||
}
|
||||
|
||||
if ( m_usecPeerAckedLifetime + k_usecLinkStatsLifetimeReportInterval < usecNow && BCheckHaveDataToSendLifetime( usecNow ) )
|
||||
if ( m_usecPeerAckedLifetime + k_usecLinkStatsLifetimeReportInterval <= usecNow && BCheckHaveDataToSendLifetime( usecNow ) )
|
||||
{
|
||||
if ( m_usecPeerAckedInstaneous + k_usecLinkStatsLifetimeReportMaxInterval < usecNow )
|
||||
if ( m_usecPeerAckedInstaneous + k_usecLinkStatsLifetimeReportMaxInterval <= usecNow )
|
||||
nResult |= k_nSendStats_Lifetime_Due;
|
||||
else
|
||||
nResult |= k_nSendStats_Lifetime_Ready;
|
||||
@@ -454,7 +454,7 @@ const char *LinkStatsTrackerBase::InternalGetSendStatsReasonOrUpdateNextThinkTim
|
||||
return nullptr;
|
||||
|
||||
int n = 0;
|
||||
if ( m_usecPeerAckedInstaneous + k_usecLinkStatsInstantaneousReportMaxInterval < usecNow && BCheckHaveDataToSendInstantaneous( usecNow ) )
|
||||
if ( m_usecPeerAckedInstaneous + k_usecLinkStatsInstantaneousReportMaxInterval <= usecNow && BCheckHaveDataToSendInstantaneous( usecNow ) )
|
||||
{
|
||||
n |= 1;
|
||||
}
|
||||
@@ -464,7 +464,7 @@ const char *LinkStatsTrackerBase::InternalGetSendStatsReasonOrUpdateNextThinkTim
|
||||
if ( usecNextCheck < inOutNextThinkTime )
|
||||
inOutNextThinkTime = usecNextCheck;
|
||||
}
|
||||
if ( m_usecPeerAckedLifetime + k_usecLinkStatsLifetimeReportMaxInterval < usecNow && BCheckHaveDataToSendLifetime( usecNow ) )
|
||||
if ( m_usecPeerAckedLifetime + k_usecLinkStatsLifetimeReportMaxInterval <= usecNow && BCheckHaveDataToSendLifetime( usecNow ) )
|
||||
{
|
||||
n |= 2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user