File tree 5 files changed +42
-0
lines changed
5 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -1228,6 +1228,19 @@ where
1228
1228
pub fn ping_pong ( & mut self ) -> Option < PingPong > {
1229
1229
self . inner . take_user_pings ( ) . map ( PingPong :: new)
1230
1230
}
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
+ }
1231
1244
}
1232
1245
1233
1246
impl < T , B > Future for Connection < T , B >
Original file line number Diff line number Diff line change @@ -120,6 +120,12 @@ where
120
120
self . settings . send_settings ( settings)
121
121
}
122
122
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
+
123
129
/// Returns `Ready` when the connection is ready to receive a frame.
124
130
///
125
131
/// 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 {
167
167
}
168
168
}
169
169
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
+
170
176
fn dec_num_streams ( & mut self , stream : & mut store:: Ptr ) {
171
177
assert ! ( stream. is_counted) ;
172
178
Original file line number Diff line number Diff line change @@ -836,6 +836,10 @@ where
836
836
Ok ( ( ) )
837
837
}
838
838
839
+ pub ( crate ) fn max_send_streams ( & self ) -> usize {
840
+ self . inner . lock ( ) . unwrap ( ) . counts . max_send_streams ( )
841
+ }
842
+
839
843
#[ cfg( feature = "unstable" ) ]
840
844
pub fn num_active_streams ( & self ) -> usize {
841
845
let me = self . inner . lock ( ) . unwrap ( ) ;
Original file line number Diff line number Diff line change @@ -529,6 +529,19 @@ where
529
529
pub fn ping_pong ( & mut self ) -> Option < PingPong > {
530
530
self . connection . take_user_pings ( ) . map ( PingPong :: new)
531
531
}
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
+ }
532
545
}
533
546
534
547
#[ cfg( feature = "stream" ) ]
You can’t perform that action at this time.
0 commit comments