Skip to content

Commit

Permalink
Check the current advertised h2 max streams
Browse files Browse the repository at this point in the history
This change fixes an issue that the actual current max send streams is
ignored.

This change requires h2 >= 0.4.6
  • Loading branch information
eaufavor authored and drcaramelsyrup committed Oct 18, 2024
1 parent 90d06aa commit 175a7bf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ httparse = "1"
bytes = "1.0"
http = "1.0.0"
log = "0.4"
h2 = ">=0.4.4"
h2 = ">=0.4.6"
once_cell = "1"
lru = "0"
ahash = ">=0.8.9"
Expand Down
5 changes: 4 additions & 1 deletion pingora-core/src/connectors/http/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,12 @@ impl ConnectionRef {
release_lock: Arc::new(Mutex::new(())),
}))
}

pub fn more_streams_allowed(&self) -> bool {
let current = self.0.current_streams.load(Ordering::Relaxed);
!self.is_shutting_down()
&& self.0.max_streams > self.0.current_streams.load(Ordering::Relaxed)
&& self.0.max_streams > current
&& self.0.connection_stub.0.current_max_send_streams() > current
}

pub fn is_idle(&self) -> bool {
Expand Down

0 comments on commit 175a7bf

Please sign in to comment.