pub fn update_rate_sample(&mut self, pkt: &Acked, now: Instant) {
        self.delivered += pkt.size;
        self.delivered_time = now;

        // Update info using the newest packet. If rate_sample is not yet
        // initialized, initialize with the first packet.
        if self.rate_sample.prior_time.is_none() ||
            pkt.delivered > self.rate_sample.prior_delivered
        {
            self.rate_sample.prior_delivered = pkt.delivered;
            self.rate_sample.prior_time = Some(pkt.delivered_time);
            self.rate_sample.is_app_limited = pkt.is_app_limited;
            self.rate_sample.send_elapsed =
                pkt.time_sent.saturating_duration_since(pkt.first_sent_time);
            self.rate_sample.rtt = pkt.rtt;
            self.rate_sample.ack_elapsed = self
                .delivered_time
                .saturating_duration_since(pkt.delivered_time);

            self.first_sent_time = pkt.time_sent;
        }

        self.largest_acked = self.largest_acked.max(pkt.pkt_num);
    }
// Update the delivery rate sample when a packet is acked.
Update the delivery rate sample when a packet is acked.
Update the delivery rate sample when a packet is acked .
pub fn update_rate_sample(&mut self, pkt: &Acked, now: Instant) {
        self.delivered += pkt.size;
        self.delivered_time = now;
        // Update info using the newest packet. If rate_sample is not yet
        // initialized, initialize with the first packet.
        if self.rate_sample.prior_time.is_none() ||
            pkt.delivered > self.rate_sample.prior_delivered
        {
            self.rate_sample.prior_delivered = pkt.delivered;
            self.rate_sample.prior_time = Some(pkt.delivered_time);
            self.rate_sample.is_app_limited = pkt.is_app_limited;
            self.rate_sample.send_elapsed =
                pkt.time_sent.saturating_duration_since(pkt.first_sent_time);
            self.rate_sample.rtt = pkt.rtt;
            self.rate_sample.ack_elapsed = self
                .delivered_time
                .saturating_duration_since(pkt.delivered_time);
            self.first_sent_time = pkt.time_sent;
        }
        self.largest_acked = self.largest_acked.max(pkt.pkt_num);
    }
pub fn update_rate_sample ( & mut self , pkt : & Acked , now : Instant ) { self . delivered += pkt . size ; self . delivered_time = now ; // Update info using the newest packet. If rate_sample is not yet // initialized, initialize with the first packet. if self . rate_sample . prior_time . is_none ( ) || pkt . delivered > self . rate_sample . prior_delivered { self . rate_sample . prior_delivered = pkt . delivered ; self . rate_sample . prior_time = Some ( pkt . delivered_time ) ; self . rate_sample . is_app_limited = pkt . is_app_limited ; self . rate_sample . send_elapsed = pkt . time_sent . saturating_duration_since ( pkt . first_sent_time ) ; self . rate_sample . rtt = pkt . rtt ; self . rate_sample . ack_elapsed = self . delivered_time . saturating_duration_since ( pkt . delivered_time ) ; self . first_sent_time = pkt . time_sent ; } self . largest_acked = self . largest_acked . max ( pkt . pkt_num ) ; }
Update the delivery rate sample when a packet is acked.
Update the delivery rate sample when a packet is acked .
&mut self
pkt
&Acked
now
Instant
&mut self
pkt
&Acked
now
Instant