diff --git a/src/quic_cc_cubic.c b/src/quic_cc_cubic.c index d22897b37..fd7fef5a2 100644 --- a/src/quic_cc_cubic.c +++ b/src/quic_cc_cubic.c @@ -197,8 +197,8 @@ static void quic_enter_recovery(struct quic_cc *cc) else { c->last_w_max = path->cwnd; } - path->cwnd = (CUBIC_BETA * path->cwnd) >> CUBIC_BETA_SCALE_SHIFT; - c->ssthresh = QUIC_MAX(path->cwnd, path->min_cwnd); + c->ssthresh = (CUBIC_BETA * path->cwnd) >> CUBIC_BETA_SCALE_SHIFT; + path->cwnd = QUIC_MAX(c->ssthresh, (uint32_t)path->min_cwnd); c->state = QUIC_CC_ST_RP; TRACE_LEAVE(QUIC_EV_CONN_CC, cc->qc, NULL, cc); } diff --git a/src/quic_cc_newreno.c b/src/quic_cc_newreno.c index 65763d762..9b132482d 100644 --- a/src/quic_cc_newreno.c +++ b/src/quic_cc_newreno.c @@ -71,7 +71,8 @@ static void quic_cc_nr_enter_recovery(struct quic_cc *cc) path = container_of(cc, struct quic_path, cc); nr->recovery_start_time = now_ms; - nr->ssthresh = QUIC_MAX(path->cwnd >> 1, path->min_cwnd); + nr->ssthresh = path->cwnd >> 1; + path->cwnd = QUIC_MAX(nr->ssthresh, (uint32_t)path->min_cwnd); nr->state = QUIC_CC_ST_RP; }