diff --git a/src/socket/tcp.rs b/src/socket/tcp.rs index f0eed51ce..bfd11fa8d 100644 --- a/src/socket/tcp.rs +++ b/src/socket/tcp.rs @@ -555,8 +555,8 @@ impl<'a> Socket<'a> { /// be more efficient and fair compared to `CongestionControl::Reno`. /// It is the default choice for Linux, Windows, and macOS. /// - /// `CongestionControl::Reno` is a classic congestion control algorithm valued for its simplicity and - /// widespread support. Despite having a lower algorithmic complexity than `Cubic`, + /// `CongestionControl::Reno` is a classic congestion control algorithm valued for its simplicity. + /// Despite having a lower algorithmic complexity than `Cubic`, /// it is less efficient in terms of bandwidth usage. pub fn set_congestion_control(&mut self, congestion_control: CongestionControl) { use congestion_controller::*; @@ -7378,4 +7378,18 @@ mod test { assert_eq!(r.retransmission_timeout(), Duration::from_millis(rto)); } } + + #[test] + fn test_set_get_congestion_control() { + let mut s = socket_established(); + + s.set_congestion_control(CongestionControl::Reno); + assert_eq!(s.get_congestion_control(), CongestionControl::Reno); + + s.set_congestion_control(CongestionControl::Cubic); + assert_eq!(s.get_congestion_control(), CongestionControl::Cubic); + + s.set_congestion_control(CongestionControl::None); + assert_eq!(s.get_congestion_control(), CongestionControl::None); + } }