Expand description
§VCL Flow Control & Congestion Control
FlowController implements sliding window flow control with
AIMD (Additive Increase Multiplicative Decrease) congestion control
and retransmission support.
§How it works
window_size = 4
Sent but unacked: [0] [1] [2] [3] <- window full, must wait
Acked: [0] <- window slides, can send [4]
Sent but unacked: [1] [2] [3] [4]§Congestion Control (AIMD)
No loss: cwnd += 1 per RTT (additive increase)
Loss: cwnd *= 0.5 (multiplicative decrease)
Min cwnd: 1
Max cwnd: bounded by window_size§Example
use vcl_protocol::flow::FlowController;
let mut fc = FlowController::new(4);
// Send packets
assert!(fc.can_send());
fc.on_send(0, vec![0]);
assert!(!fc.can_send()); // window full
// Acknowledge packets
fc.on_ack(0);
assert!(fc.can_send()); // window has space againStructs§
- Flow
Controller - Sliding window flow controller with AIMD congestion control and retransmission support.
- InFlight
Packet - A packet that has been sent but not yet acknowledged.
- Retransmit
Request - A packet that needs to be retransmitted.