Skip to content

Commit 52db920

Browse files
committed
expose max concurrent send streams
1 parent 2c8c847 commit 52db920

File tree

5 files changed

+28
-0
lines changed

5 files changed

+28
-0
lines changed

src/client.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1228,6 +1228,12 @@ where
12281228
pub fn ping_pong(&mut self) -> Option<PingPong> {
12291229
self.inner.take_user_pings().map(PingPong::new)
12301230
}
1231+
1232+
/// Returns the maximum number of concurrent streams that may be initiated
1233+
/// by this client.
1234+
pub fn max_concurrent_send_streams(&self) -> usize {
1235+
self.inner.max_send_streams()
1236+
}
12311237
}
12321238

12331239
impl<T, B> Future for Connection<T, B>

src/proto/connection.rs

+6
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ where
120120
self.settings.send_settings(settings)
121121
}
122122

123+
/// Returns the maximum number of concurrent streams that may be initiated
124+
/// by this peer.
125+
pub(crate) fn max_send_streams(&self) -> usize {
126+
self.streams.max_send_streams()
127+
}
128+
123129
/// Returns `Ready` when the connection is ready to receive a frame.
124130
///
125131
/// Returns `RecvError` as this may raise errors that are caused by delayed

src/proto/streams/counts.rs

+6
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,12 @@ impl Counts {
167167
}
168168
}
169169

170+
/// Returns the maximum number of streams that can be initiated by this
171+
/// peer.
172+
pub(crate) fn max_send_streams(&self) -> usize {
173+
self.max_send_streams
174+
}
175+
170176
fn dec_num_streams(&mut self, stream: &mut store::Ptr) {
171177
assert!(stream.is_counted);
172178

src/proto/streams/streams.rs

+4
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,10 @@ where
836836
Ok(())
837837
}
838838

839+
pub(crate) fn max_send_streams(&self) -> usize {
840+
self.inner.lock().unwrap().counts.max_send_streams()
841+
}
842+
839843
#[cfg(feature = "unstable")]
840844
pub fn num_active_streams(&self) -> usize {
841845
let me = self.inner.lock().unwrap();

src/server.rs

+6
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,12 @@ where
529529
pub fn ping_pong(&mut self) -> Option<PingPong> {
530530
self.connection.take_user_pings().map(PingPong::new)
531531
}
532+
533+
/// Returns the maximum number of concurrent streams that may be initiated
534+
/// by the server on this connection.
535+
pub fn max_concurrent_send_streams(&self) -> usize {
536+
self.connection.max_send_streams()
537+
}
532538
}
533539

534540
#[cfg(feature = "stream")]

0 commit comments

Comments
 (0)