1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use crate::packet::SequenceNumber;
use std::time::Instant;

#[derive(Clone)]
/// This contains the information required to reassemble fragments.
pub struct CongestionData {
    pub sequence: SequenceNumber,
    pub sending_time: Instant,
}

impl CongestionData {
    pub fn new(sequence: SequenceNumber, sending_time: Instant) -> Self {
        CongestionData {
            sequence,
            sending_time,
        }
    }
}

impl Default for CongestionData {
    fn default() -> Self {
        CongestionData {
            sequence: 0,
            sending_time: Instant::now(),
        }
    }
}