Skip to content

Commit

Permalink
add active stream prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
taikulawo committed Dec 25, 2024
1 parent af3d026 commit 4cf6bc5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,6 @@ where
}
}

#[cfg(feature = "unstable")]
impl<B> SendRequest<B>
where
B: Buf,
Expand Down
8 changes: 7 additions & 1 deletion src/proto/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ where
pub(crate) fn max_recv_streams(&self) -> usize {
self.inner.streams.max_recv_streams()
}
/// Returns the number of active stream
pub(crate) fn active_streams(&self) -> usize {
self.inner.streams.num_active_streams()
}

#[cfg(feature = "unstable")]
pub fn num_wired_streams(&self) -> usize {
Expand Down Expand Up @@ -303,7 +307,9 @@ where
) {
(Some(sleep), _) => {
ready!(sleep.as_mut().poll(cx));
self.inner.as_dyn().go_away_now(Reason::KEEPALIVE_TIMEOUT);
self.inner
.as_dyn()
.go_away_now(Reason::KEEPALIVE_TIMEOUT);
continue 'outer;
}
(None, Some(timeout)) => {
Expand Down
1 change: 0 additions & 1 deletion src/proto/streams/streams.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,6 @@ where
self.inner.lock().unwrap().counts.max_recv_streams()
}

#[cfg(feature = "unstable")]
pub fn num_active_streams(&self) -> usize {
let me = self.inner.lock().unwrap();
me.store.num_active_streams()
Expand Down
9 changes: 9 additions & 0 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,15 @@ where
self.connection.max_recv_streams()
}

/// Returns whether has stream alive
pub fn has_streams_or_other_references(&self) -> bool {
self.connection.has_streams_or_other_references()
}
/// Returns the number of current active stream.
pub fn active_stream(&self) -> usize {
self.connection.active_streams()
}

// Could disappear at anytime.
#[doc(hidden)]
#[cfg(feature = "unstable")]
Expand Down

0 comments on commit 4cf6bc5

Please sign in to comment.