Skip to content

Commit

Permalink
Fix the issue with sending MAX_DATA frames
Browse files Browse the repository at this point in the history
  • Loading branch information
iyangsj committed Jul 11, 2024
1 parent 9d7f147 commit c1b25ef
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/connection/connection.rs
Original file line number Diff line number Diff line change
@@ -2158,9 +2158,7 @@ impl Connection {
}

// Create MAX_DATA frame if needed.
if self.streams.rx_almost_full
&& self.streams.max_rx_data() < self.streams.max_rx_data_next()
{
if self.streams.need_send_max_data() {
// Adjust the connection window size automatically.
self.streams
.autotune_window(now, path.recovery.rtt.smoothed_rtt());
8 changes: 7 additions & 1 deletion src/connection/stream.rs
Original file line number Diff line number Diff line change
@@ -708,10 +708,16 @@ impl StreamMap {
}
}

/// Return true if we should send `MAX_DATA` frame to peer to update
/// the connection level flow control limit.
pub fn need_send_max_data(&self) -> bool {
self.rx_almost_full && self.max_rx_data() < self.max_rx_data_next()
}

/// Return true if need to send stream frames.
pub fn need_send_stream_frames(&self) -> bool {
self.has_sendable_streams()
|| self.rx_almost_full
|| self.need_send_max_data()
|| self.data_blocked_at().is_some()
|| self.should_send_max_streams()
|| self.has_almost_full_streams()

0 comments on commit c1b25ef

Please sign in to comment.