Reset any queued stream on receipt of remote reset (#258)
Fixes #256. This PR changes `state::recv_reset` so any closed stream with queued send is immediately reset (and thus, the queue is cleared) on receipt of a `RST_STREAM` frame from the remote. This fixes the panic encountered by the test @goffrie posted in #256, where the stream is scheduled to close, receives a `RST_STREAM` frame, and sets the buffered capacity to 0, but isn't removed from the send queue, so we hit an assertion (or wrap, if debug assertions are disabled) when subtracting a sent frame's size from the buffered size. Signed-off-by: Eliza Weisman <eliza@buoyant.io>
This commit is contained in:
		| @@ -593,6 +593,8 @@ impl Prioritize { | ||||
|                     // To be safe, we just always ask the stream. | ||||
|                     let is_counted = stream.is_counted(); | ||||
|                     let is_pending_reset = stream.is_pending_reset_expiration(); | ||||
|                     trace!(" --> stream={:?}; is_pending_reset={:?};", | ||||
|                         stream.id, is_pending_reset); | ||||
|  | ||||
|                     let frame = match stream.pending_send.pop_front(buffer) { | ||||
|                         Some(Frame::Data(mut frame)) => { | ||||
| @@ -603,13 +605,14 @@ impl Prioritize { | ||||
|  | ||||
|                             trace!( | ||||
|                                 " --> data frame; stream={:?}; sz={}; eos={:?}; window={}; \ | ||||
|                                  available={}; requested={}", | ||||
|                                  available={}; requested={}; buffered={};", | ||||
|                                 frame.stream_id(), | ||||
|                                 sz, | ||||
|                                 frame.is_end_stream(), | ||||
|                                 stream_capacity, | ||||
|                                 stream.send_flow.available(), | ||||
|                                 stream.requested_send_capacity | ||||
|                                 stream.requested_send_capacity, | ||||
|                                 stream.buffered_send_data, | ||||
|                             ); | ||||
|  | ||||
|                             // Zero length data frames always have capacity to | ||||
|   | ||||
		Reference in New Issue
	
	Block a user