diff --git a/src/core/connection.c b/src/core/connection.c index 261830bba..6be8b788f 100644 --- a/src/core/connection.c +++ b/src/core/connection.c @@ -653,6 +653,13 @@ QuicConnUpdateRtt( BOOLEAN RttUpdated; UNREFERENCED_PARAMETER(Connection); + if (LatestRtt == 0) { + // + // RTT cannot be zero or several loss recovery algorithms break down. + // + LatestRtt = 1; + } + Path->LatestRttSample = LatestRtt; if (LatestRtt < Path->MinRtt) { Path->MinRtt = LatestRtt; @@ -680,6 +687,7 @@ QuicConnUpdateRtt( } if (RttUpdated) { + QUIC_DBG_ASSERT(Path->SmoothedRtt != 0); QuicTraceLogConnVerbose(RttUpdated, Connection, "Updated Rtt=%u.%u ms, Var=%u.%u", Path->SmoothedRtt / 1000, Path->SmoothedRtt % 1000, Path->RttVariance / 1000, Path->RttVariance % 1000); diff --git a/src/core/loss_detection.c b/src/core/loss_detection.c index 986f9dbc8..c43df9fd1 100644 --- a/src/core/loss_detection.c +++ b/src/core/loss_detection.c @@ -174,6 +174,8 @@ QuicLossDetectionComputeProbeTimeout( { QUIC_CONNECTION* Connection = QuicLossDetectionGetConnection(LossDetection); + QUIC_DBG_ASSERT(Path->SmoothedRtt != 0); + // // Microseconds. // @@ -242,6 +244,8 @@ QuicLossDetectionUpdateTimer( uint32_t TimeNow = QuicTimeUs32(); + QUIC_DBG_ASSERT(Path->SmoothedRtt != 0); + uint32_t TimeFires; QUIC_LOSS_TIMER_TYPE TimeoutType; if (OldestPacket != NULL && diff --git a/src/core/path.c b/src/core/path.c index a53c237a8..46fd06b74 100644 --- a/src/core/path.c +++ b/src/core/path.c @@ -30,6 +30,11 @@ QuicPathInitialize( Path->ID = Connection->NextPathId++; // TODO - Check for duplicates after wrap around? Path->MinRtt = UINT32_MAX; Path->Mtu = QUIC_DEFAULT_PATH_MTU; + if (Connection->Session != NULL) { + Path->SmoothedRtt = MS_TO_US(Connection->Session->Settings.InitialRttMs); + } else { + Path->SmoothedRtt = MS_TO_US(QUIC_INITIAL_RTT); + } QuicTraceLogConnInfo(PathInitialized, Connection, "Path[%u] Initialized", Path->ID); }