mirror of
https://github.com/n0-computer/noq.git
synced 2026-09-25 12:57:07 +00:00
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.
This commit is contained in:
committed by
Dirkjan Ochtman
parent
49e57a2f41
commit
728fdb9b61
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user