Skip to content

Commit

Permalink
Reduce coercion
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralith committed Jan 23, 2024
1 parent 86bac4b commit 9ebcc0c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions quinn-proto/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,9 +617,10 @@ impl Connection {
// for starting another datagram. If there is any anti-amplification
// budget left, we always allow a full MTU to be sent
// (see https://github.com/quinn-rs/quinn/issues/1082)
if self.path.anti_amplification_blocked(
self.path.current_mtu() as u64 * num_datagrams as u64 + 1,
) {
if self
.path
.anti_amplification_blocked(self.path.current_mtu() as u64 * num_datagrams + 1)
{
trace!("blocked by anti-amplification");
break;
}
Expand Down Expand Up @@ -728,7 +729,7 @@ impl Connection {
space_id,
buf,
buf_capacity,
(num_datagrams - 1) * (self.path.current_mtu() as usize),
(num_datagrams as usize - 1) * (self.path.current_mtu() as usize),
ack_eliciting,
self,
self.version,
Expand Down Expand Up @@ -898,7 +899,7 @@ impl Connection {
trace!("sending {} bytes in {} datagrams", buf.len(), num_datagrams);
self.path.total_sent = self.path.total_sent.saturating_add(buf.len() as u64);

self.stats.udp_tx.on_sent(num_datagrams as u64, buf.len());
self.stats.udp_tx.on_sent(num_datagrams, buf.len());

Some(Transmit {
destination: self.path.remote,
Expand Down

0 comments on commit 9ebcc0c

Please sign in to comment.