From 728fdb9b61030649c29ce3c19b1177c17ec9d324 Mon Sep 17 00:00:00 2001 From: Matthias Einwag Date: Wed, 20 Jan 2021 19:16:25 +0000 Subject: [PATCH] Reset pacing timer The pacing implementation did so far not do anything. The reason for that is the timestamp when tokens had been last generated was never updated. Therefore each Pacer::delay call where not enough tokens had been available calculated tokens based on the time back to when the Pacer was initially created, which fully refills the capacity. This is easily fixed by storing the timestamp when tokens are replenished. --- quinn-proto/src/connection/pacing.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/quinn-proto/src/connection/pacing.rs b/quinn-proto/src/connection/pacing.rs index 0e0074a07..97e4cc753 100644 --- a/quinn-proto/src/connection/pacing.rs +++ b/quinn-proto/src/connection/pacing.rs @@ -75,6 +75,8 @@ impl Pacer { .saturating_add(new_tokens as _) .min(self.capacity); + self.prev = now; + // if we can already send a packet, there is no need for delay if self.tokens > mtu.into() { return None;