Release closed streams capacity back to connection (#334)
Previously, any streams that were dropped or closed while not having consumed the inflight received window capacity would simply leak that capacity for the connection. This could easily happen if a `RecvStream` were dropped before fully consuming the data, and therefore a user would have no idea how much capacity to release in the first place. This resulted in stalled connections that would never have capacity again.
This commit is contained in:
		| @@ -1118,10 +1118,16 @@ fn drop_stream_ref(inner: &Mutex<Inner>, key: store::Key) { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|  | ||||
|     me.counts.transition(stream, |counts, stream| { | ||||
|         maybe_cancel(stream, actions, counts); | ||||
|  | ||||
|         if stream.ref_count == 0 { | ||||
|  | ||||
|             // Release any recv window back to connection, no one can access | ||||
|             // it anymore. | ||||
|             actions.recv.release_closed_capacity(stream, &mut actions.task); | ||||
|  | ||||
|             // We won't be able to reach our push promises anymore | ||||
|             let mut ppp = stream.pending_push_promises.take(); | ||||
|             while let Some(promise) = ppp.pop(stream.store_mut()) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user