File tree Expand file tree Collapse file tree 5 files changed +42
-0
lines changed Expand file tree Collapse file tree 5 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -1228,6 +1228,19 @@ 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+ ///
1235+ /// This limit is configured by the server peer by sending the
1236+ /// [`SETTINGS_MAX_CONCURRENT_STREAMS` parameter][settings] in a `SETTINGS`
1237+ /// frame. This method returns the currently acknowledged value recieved
1238+ /// from the remote.
1239+ ///
1240+ /// [settings]: https://tools.ietf.org/html/rfc7540#section-5.1.2
1241+ pub fn max_concurrent_send_streams ( & self ) -> usize {
1242+ self . inner . max_send_streams ( )
1243+ }
12311244}
12321245
12331246impl < T , B > Future for Connection < T , B >
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 ( ) ;
Original file line number Diff line number Diff line change @@ -529,6 +529,19 @@ 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+ ///
536+ /// This limit is configured by the client peer by sending the
537+ /// [`SETTINGS_MAX_CONCURRENT_STREAMS` parameter][settings] in a `SETTINGS`
538+ /// frame. This method returns the currently acknowledged value recieved
539+ /// from the remote.
540+ ///
541+ /// [settings]: https://tools.ietf.org/html/rfc7540#section-5.1.2
542+ pub fn max_concurrent_send_streams ( & self ) -> usize {
543+ self . connection . max_send_streams ( )
544+ }
532545}
533546
534547#[ cfg( feature = "stream" ) ]
You can’t perform that action at this time.
0 commit comments