Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ tokio = { version = "1", features = ["sync"] }

futures-channel = { version = "0.3", optional = true }
futures-util = { version = "0.3", default-features = false, optional = true }
h2 = { version = "0.4.2", optional = true }
h2 = { version = "0.4.9", optional = true }
http-body-util = { version = "0.1", optional = true }
httparse = { version = "1.9", optional = true }
httpdate = { version = "1.0", optional = true }
Expand Down
13 changes: 13 additions & 0 deletions src/proto/h2/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,19 @@ where
}
}
}

/// Checks if handshaking has completed
pub(crate) fn has_handshake_completed(&self) -> bool {
matches!(self.state, State::Serving { .. })
}

/// Checks if there are any streams
pub(crate) fn has_streams(&self) -> bool {
match self.state {
State::Handshaking { .. } => false,
State::Serving(ref srv) => srv.conn.has_streams(),
}
}
}

impl<T, S, B, E> Future for Server<T, S, B, E>
Expand Down
10 changes: 10 additions & 0 deletions src/server/conn/http2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ where
pub fn graceful_shutdown(mut self: Pin<&mut Self>) {
self.conn.graceful_shutdown();
}

/// Checks if handshaking has completed
pub fn has_handshake_completed(&self) -> bool {
self.conn.has_handshake_completed()
}

/// Checks if there are any streams
pub fn has_streams(&self) -> bool {
self.conn.has_streams()
}
}

impl<I, B, S, E> Future for Connection<I, S, E>
Expand Down