pub fn classify(&mut self, rott: f64) -> PacketLoss {
        if rott < self.rott_min {
            self.rott_min = rott;
        }
        if rott > self.rott_max {
            self.rott_max = rott;
        }

        let b_spike_start = self.rott_min + self.alpha * (self.rott_max - self.rott_min);
        let b_spike_end = self.rott_min + self.beta * (self.rott_max - self.rott_min);

        match self.state {
            State::Spike => {
                if rott < b_spike_end {
                    self.state = State::Normal;
                    return PacketLoss::Wireless;
                }
                return PacketLoss::Congestion;
            }
            State::Normal => {
                if rott > b_spike_start {
                    self.state = State::Spike;
                    return PacketLoss::Congestion;
                }
                return PacketLoss::Wireless;
            }
        }
    }
/// Classifies the reason of packet loss based on the ROTT of the current packet.
///
/// This function is called with the ROTT (relative one-way trip time) of the current
/// packet if previous packets were lost
///
/// # Arguments
///
/// - `rott`: relative one-way trip time of the current packet.
Classifies the reason of packet loss based on the ROTT of the current packet.
This function is called with the ROTT (relative one-way trip time) of the current
packet if previous packets were lost
Classifies the reason of packet loss based on the ROTT of the current packet . This function is called with the ROTT ( relative one - way trip time ) of the current packet if previous packets were lost
pub fn classify(&mut self, rott: f64) -> PacketLoss {
        if rott < self.rott_min {
            self.rott_min = rott;
        }
        if rott > self.rott_max {
            self.rott_max = rott;
        }
        let b_spike_start = self.rott_min + self.alpha * (self.rott_max - self.rott_min);
        let b_spike_end = self.rott_min + self.beta * (self.rott_max - self.rott_min);
        match self.state {
            State::Spike => {
                if rott < b_spike_end {
                    self.state = State::Normal;
                    return PacketLoss::Wireless;
                }
                return PacketLoss::Congestion;
            }
            State::Normal => {
                if rott > b_spike_start {
                    self.state = State::Spike;
                    return PacketLoss::Congestion;
                }
                return PacketLoss::Wireless;
            }
        }
    }
pub fn classify ( & mut self , rott : f64 ) -> PacketLoss { if rott < self . rott_min { self . rott_min = rott ; } if rott > self . rott_max { self . rott_max = rott ; } let b_spike_start = self . rott_min + self . alpha * ( self . rott_max - self . rott_min ) ; let b_spike_end = self . rott_min + self . beta * ( self . rott_max - self . rott_min ) ; match self . state { State :: Spike => { if rott < b_spike_end { self . state = State :: Normal ; return PacketLoss :: Wireless ; } return PacketLoss :: Congestion ; } State :: Normal => { if rott > b_spike_start { self . state = State :: Spike ; return PacketLoss :: Congestion ; } return PacketLoss :: Wireless ; } } }
Classifies the reason of packet loss based on the ROTT of the current packet.
Classifies the reason of packet loss based on the ROTT of the current packet .
&mut self
rott
f64
relative one-way trip time of the current packet.
relative one - way trip time of the current packet .