diff --git a/quinn-proto/src/connection/mod.rs b/quinn-proto/src/connection/mod.rs index 936cbb827..316408645 100644 --- a/quinn-proto/src/connection/mod.rs +++ b/quinn-proto/src/connection/mod.rs @@ -371,7 +371,7 @@ where } } - if self.path.anti_amplification_blocked(self.mtu) { + if self.path.anti_amplification_blocked(self.mtu.into()) { trace!("blocked by anti-amplification"); return None; } @@ -1481,7 +1481,7 @@ where return; } - if self.path.anti_amplification_blocked(self.mtu) { + if self.path.anti_amplification_blocked(self.mtu.into()) { // We wouldn't be able to send anything, so don't bother. self.timers.stop(Timer::LossDetection); return; diff --git a/quinn-proto/src/connection/paths.rs b/quinn-proto/src/connection/paths.rs index 646126c2b..37f207401 100644 --- a/quinn-proto/src/connection/paths.rs +++ b/quinn-proto/src/connection/paths.rs @@ -65,9 +65,9 @@ impl PathData { } /// Indicates whether we're a server that hasn't validated the peer's address and hasn't - /// received enough data from the peer to permit additional sending - pub fn anti_amplification_blocked(&self, mtu: u16) -> bool { - !self.validated && self.total_recvd * 3 < self.total_sent + u64::from(mtu) + /// received enough data from the peer to permit sending `bytes_to_send` additional bytes + pub fn anti_amplification_blocked(&self, bytes_to_send: u64) -> bool { + !self.validated && self.total_recvd * 3 < self.total_sent + bytes_to_send } }