Skip to content

Commit 295dc06

Browse files
junhochoighedo
authored andcommitted
recovery: update packet.time_sent with pacing rate
Sent/Acked.time_sent is the timestamp when the packet is transmitted. With the pacing rate calculation, it might indicate the future and impact the delivery rate esimation which uses the value. Now we update Sent.time_sent with the timestamp after packet scheduling based on the pacing rate. When pacing is not used in the application, this doesn't have an impact because the application will ignore the pacing rate.
1 parent b048c85 commit 295dc06

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

quiche/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5553,6 +5553,11 @@ pub struct Stats {
55535553
pub pmtu: usize,
55545554

55555555
/// The most recent data delivery rate estimate in bytes/s.
5556+
///
5557+
/// Note that this value could be inaccurate if the application does not
5558+
/// respect pacing hints (see [`SendInfo.at`]).
5559+
///
5560+
/// [`SendInfo.at`]: struct.SendInfo.html#structfield.at
55565561
pub delivery_rate: u64,
55575562

55585563
/// The maximum idle timeout.

quiche/src/recovery/mod.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,6 @@ impl Recovery {
293293
self.set_loss_detection_timer(handshake_status, now);
294294
}
295295

296-
self.sent[epoch].push_back(pkt);
297-
298296
// HyStart++: Start of the round in a slow start.
299297
if self.hystart.enabled() &&
300298
epoch == packet::EPOCH_APPLICATION &&
@@ -316,6 +314,10 @@ impl Recovery {
316314

317315
self.schedule_next_packet(epoch, now, sent_bytes);
318316

317+
pkt.time_sent = self.get_packet_send_time();
318+
319+
self.sent[epoch].push_back(pkt);
320+
319321
self.bytes_sent += sent_bytes;
320322
trace!("{} {:?}", trace_id, self);
321323
}
@@ -483,7 +485,10 @@ impl Recovery {
483485
}
484486

485487
if largest_newly_acked_pkt_num == largest_acked && has_ack_eliciting {
486-
let latest_rtt = now - largest_newly_acked_sent_time;
488+
// The packet's sent time could be in the future if pacing is used
489+
// and the network has a very short RTT.
490+
let latest_rtt =
491+
now.saturating_duration_since(largest_newly_acked_sent_time);
487492

488493
let ack_delay = if epoch == packet::EPOCH_APPLICATION {
489494
Duration::from_micros(ack_delay)

0 commit comments

Comments
 (0)