File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
quinn-proto/src/connection Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -576,9 +576,10 @@ impl Connection {
576576 // for starting another datagram. If there is any anti-amplification
577577 // budget left, we always allow a full MTU to be sent
578578 // (see https://github.com/quinn-rs/quinn/issues/1082)
579- if self . path . anti_amplification_blocked (
580- ( transmit. segment_size ( ) * transmit. num_datagrams ( ) ) as u64 + 1 ,
581- ) {
579+ if self
580+ . path
581+ . anti_amplification_blocked ( transmit. capacity ( ) as u64 + 1 )
582+ {
582583 trace ! ( "blocked by anti-amplification" ) ;
583584 break ;
584585 }
Original file line number Diff line number Diff line change @@ -165,6 +165,17 @@ impl<'a> TransmitBuilder<'a> {
165165 self . num_datagrams >= self . max_datagrams
166166 }
167167
168+ /// The sum of the capacity of all started datagrams in the transmit
169+ ///
170+ /// This might be more than [`len`] when the current datagram is not yet fully
171+ /// written. In other words: this is the length of the transmit when the current
172+ /// datagram would fill the entire segment size.
173+ ///
174+ /// [`len`]: TransmitBuf::len
175+ pub ( super ) fn capacity ( & self ) -> usize {
176+ self . segment_size * self . num_datagrams
177+ }
178+
168179 /// Returns the GSO segment size
169180 ///
170181 /// This is also the maximum size datagrams are allowed to be. The first and last
You can’t perform that action at this time.
0 commit comments