@@ -184,7 +184,15 @@ impl Prioritize {
184
184
stream. requested_send_capacity =
185
185
cmp:: min ( stream. buffered_send_data , WindowSize :: MAX as usize ) as WindowSize ;
186
186
187
- self . try_assign_capacity ( stream) ;
187
+ // `try_assign_capacity` will queue the stream to `pending_capacity` if the capcaity
188
+ // cannot be assigned at the time it is called.
189
+ //
190
+ // Streams over the max concurrent count will still call `send_data` so we should be
191
+ // careful not to put it into `pending_capacity` as it will starve the connection
192
+ // capacity for other streams
193
+ if !stream. is_pending_open {
194
+ self . try_assign_capacity ( stream) ;
195
+ }
188
196
}
189
197
190
198
if frame. is_end_stream ( ) {
@@ -474,13 +482,7 @@ impl Prioritize {
474
482
//
475
483
// In this case, the stream needs to be queued up for when the
476
484
// connection has more capacity.
477
- if stream. is_send_ready ( ) {
478
- // Prioritize assigning capacity to a send-ready stream
479
- // See https://github.com/hyperium/hyper/issues/3338
480
- self . pending_capacity . push_front ( stream) ;
481
- } else {
482
- self . pending_capacity . push ( stream) ;
483
- }
485
+ self . pending_capacity . push ( stream) ;
484
486
}
485
487
486
488
// If data is buffered and the stream is send ready, then
@@ -528,6 +530,7 @@ impl Prioritize {
528
530
loop {
529
531
if let Some ( mut stream) = self . pop_pending_open ( store, counts) {
530
532
self . pending_send . push_front ( & mut stream) ;
533
+ self . try_assign_capacity ( & mut stream) ;
531
534
}
532
535
533
536
match self . pop_frame ( buffer, store, max_frame_len, counts) {
0 commit comments