add Connection::max_concurrent_send_streams (#513)
This PR adds accessors to `client::Connection` and `server::Connection` that return the send stream concurrency limit on that connection, as negotiated by the remote peer. This is part of issue #512. I think we probably ought to expose similar accessors for other settings, but I thought it was better to add each one in a separate, focused PR. Signed-off-by: Eliza Weisman <eliza@buoyant.io>
This commit is contained in:
@@ -120,6 +120,12 @@ where
|
||||
self.settings.send_settings(settings)
|
||||
}
|
||||
|
||||
/// Returns the maximum number of concurrent streams that may be initiated
|
||||
/// by this peer.
|
||||
pub(crate) fn max_send_streams(&self) -> usize {
|
||||
self.streams.max_send_streams()
|
||||
}
|
||||
|
||||
/// Returns `Ready` when the connection is ready to receive a frame.
|
||||
///
|
||||
/// Returns `RecvError` as this may raise errors that are caused by delayed
|
||||
|
||||
@@ -167,6 +167,12 @@ impl Counts {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the maximum number of streams that can be initiated by this
|
||||
/// peer.
|
||||
pub(crate) fn max_send_streams(&self) -> usize {
|
||||
self.max_send_streams
|
||||
}
|
||||
|
||||
fn dec_num_streams(&mut self, stream: &mut store::Ptr) {
|
||||
assert!(stream.is_counted);
|
||||
|
||||
|
||||
@@ -836,6 +836,10 @@ where
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(crate) fn max_send_streams(&self) -> usize {
|
||||
self.inner.lock().unwrap().counts.max_send_streams()
|
||||
}
|
||||
|
||||
#[cfg(feature = "unstable")]
|
||||
pub fn num_active_streams(&self) -> usize {
|
||||
let me = self.inner.lock().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user