Skip to content

Commit 493239d

Browse files
committed
fix: typo
1 parent 372bfb7 commit 493239d

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

rattan-core/src/cells/bandwidth/mod.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ where
208208
// Here, either:
209209
// 1) No more packets can be retrived from egress, or
210210
// 2) A packet, that should enter the queue after `self.next_available` is seen.
211-
// Thus the `dequeue_at()` see a correct queue, containing any packet that should
211+
// Thus the `dequeue_at()` sees a correct queue, containing any packet that should
212212
// enter the AQM at `self.next_available`.
213213
let mut packet = self.packet_queue.dequeue_at(self.next_available);
214214

@@ -503,8 +503,8 @@ where
503503
if let Some((bandwidth, duration)) = self.trace.next_bw() {
504504
self.change_bandwidth(bandwidth, change_time);
505505
self.next_change = change_time + duration;
506-
// #[cfg(test)]
507-
eprintln!(
506+
#[cfg(test)]
507+
trace!(
508508
"Bandwidth changed to {:?}, next change after {:?}. now {:?}",
509509
bandwidth,
510510
self.next_change - Instant::now(),
@@ -602,7 +602,7 @@ where
602602
// Here, either:
603603
// 1) No more packets can be retrived from egress, or
604604
// 2) A packet, that should enter the queue after `self.next_available` is seen.
605-
// Thus the `dequeue_at()` see a correct queue, containing any packet that should
605+
// Thus the `dequeue_at()` sees a correct queue, containing any packet that should
606606
// enter the AQM at `self.next_available`.
607607
let mut packet = self.packet_queue.dequeue_at(self.next_available);
608608

@@ -655,7 +655,6 @@ where
655655
fn reset(&mut self) {
656656
self.next_available = *TRACE_START_INSTANT.get_or_init(Instant::now);
657657
self.next_change = *TRACE_START_INSTANT.get_or_init(Instant::now);
658-
eprintln!("Reset to {:?}", self.next_change);
659658
}
660659

661660
fn change_state(&self, state: CellState) {

rattan-core/src/cells/bandwidth/queue.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ where
6868
.is_none_or(|t| t <= next_available)
6969
}
7070

71-
/// Return the packet immediately, if the inner queue is zero-buffered.
71+
/// Enqueue a packet into the AQM.
72+
///
73+
/// If the inner queue is zero-buffered, the packet is returned immediately.
7274
pub fn enqueue(&mut self, packet: P) -> Option<P> {
7375
self.latest_enqueue_timestamp = packet.get_timestamp().into();
7476
if self.queue.is_zero_buffer() {
@@ -79,9 +81,13 @@ where
7981
}
8082
}
8183

84+
/// Dequeue a packet from the AQM based on the timestamp.
85+
/// The function tries to maintain the queue status at the given timestamp before dequeing a packet,
86+
/// by enqueuing any packets that should have been enqueued by that timestamp.
87+
///
8288
/// The caller ensures that:
83-
/// 1) This function is not called before the `timestamp` here.
84-
/// 2) The timestamp should be non-decending.
89+
/// 1) This function is not called before the wall-clock time of `timestamp`.
90+
/// 2) The timestamp should be non-descending.
8591
pub fn dequeue_at(&mut self, timestamp: Instant) -> Option<P> {
8692
while let Some(head) = self.inbound_buffer.front() {
8793
if head.get_timestamp() <= timestamp {

0 commit comments

Comments
 (0)