From 754bf32580b609cca474ceb7034abbcf8b2c1acb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Wed, 8 Jun 2022 09:45:25 +0200 Subject: [PATCH] add a check to break the sending loop if the current bytes got greater than the total bytes. We calculate a max bandwidth, but due to framing the packages, i think its possible for the current_bytes to get a few bytes over the actuall planed bandwidth. which prob isn't that bad/unfair --- network/protocol/src/prio.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/network/protocol/src/prio.rs b/network/protocol/src/prio.rs index f66e73313c..c964f9c488 100644 --- a/network/protocol/src/prio.rs +++ b/network/protocol/src/prio.rs @@ -130,6 +130,9 @@ impl PrioManager { continue; } process_stream(sid, stream, per_stream_bytes, &mut cur_bytes); + if cur_bytes >= total_bytes { + break; + } } } }