diff --git a/tests/test_etcp_bbr.c b/tests/test_etcp_bbr.c index c77666422..4b2ff247e 100644 --- a/tests/test_etcp_bbr.c +++ b/tests/test_etcp_bbr.c @@ -201,12 +201,16 @@ static int test_loss_startup(void) static int test_cwnd_bounded(void) { - MSEG("cwnd capped by inflight_hi"); - struct bbr s; memset(&s, 0, sizeof(s)); s.now_tb = 10000; bbr_init(&s); - s.mode = BBR_PROBE_BW; s.full_bw_reached = 1; s.cycle_idx = BBR_BW_PROBE_UP; - s.inflight_hi = 4000; s.inflight_lo = 4000; g_cwnd = 5600; g_pacing = 0; - s.now_tb += 5000; run_ack(&s, 1400, 5000, 0, 0, 5000); - if (g_cwnd > 4000) FAIL("cwnd > inflight_hi"); + MSEG("inflight bounds respect the four-MSS minimum"); + const uint32_t caps[] = {4000, 8000}, expected[] = {5600, 8000}; + for (unsigned i = 0; i < 2; i++) { + struct bbr s = { .now_tb = 10000 }; bbr_init(&s); + s.mode = BBR_PROBE_BW; s.full_bw_reached = 1; s.cycle_idx = BBR_BW_PROBE_UP; + s.inflight_hi = s.inflight_lo = caps[i]; g_cwnd = 14000; g_pacing = 0; + s.now_tb += 5000; run_ack(&s, 1400, 5000, 0, 0, 14000); + DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "BBR window bound: cap=%u minimum=5600 cwnd=%u", caps[i], g_cwnd); + if (g_cwnd != expected[i]) FAIL("inflight bounds must not reduce cwnd below four MSS"); + } PASS(); return 0; } diff --git a/tests/test_etcp_windows.c b/tests/test_etcp_windows.c index a8524666b..c6c4b0332 100644 --- a/tests/test_etcp_windows.c +++ b/tests/test_etcp_windows.c @@ -363,6 +363,7 @@ static void bbr_probe_window(void) { CHECK(last_mss == conn->normalizer->frag_size && a->inflight_lim_bytes == minimum && minimum < INFLIGHT_LIM_MIN); struct INFLIGHT_PACKET* probe = enqueue(1000); CHECK(!request()); ack(2); ack(3); ack(4); CHECK(a->bbr->probe_rtt_done_stamp_tb); + ack(5); // оставшиеся 3000 байт и новый фрагмент целиком помещаются в 4388 struct ETCP_DGRAM* pkt = request(); CHECK(pkt && probe->is_app_limited); memory_pool_free(inst.pkt_pool, pkt); test_clock_run_for(ua, 10); a->bbr->now_tb += BBR_PROBE_RTT_MS * 10;