Misc bug fixes related to stream state (#273)
This patch includes two new significant debug assertions: * Assert stream counts are zero when the connection finalizes. * Assert all stream state has been released when the connection is dropped. These two assertions were added in an effort to test the fix provided by #261. In doing so, many related bugs have been discovered and fixed. The details related to these bugs can be found in #273.
This commit is contained in:
		| @@ -22,6 +22,10 @@ pub(super) struct Stream { | ||||
|     /// Current state of the stream | ||||
|     pub state: State, | ||||
|  | ||||
|     /// Set to `true` when the stream is counted against the connection's max | ||||
|     /// concurrent streams. | ||||
|     pub is_counted: bool, | ||||
|  | ||||
|     /// Number of outstanding handles pointing to this stream | ||||
|     pub ref_count: usize, | ||||
|  | ||||
| @@ -151,6 +155,7 @@ impl Stream { | ||||
|             id, | ||||
|             state: State::default(), | ||||
|             ref_count: 0, | ||||
|             is_counted: false, | ||||
|  | ||||
|             // ===== Fields related to sending ===== | ||||
|             next_pending_send: None, | ||||
| @@ -194,12 +199,6 @@ impl Stream { | ||||
|         self.ref_count -= 1; | ||||
|     } | ||||
|  | ||||
|     /// Returns true if a stream with the current state counts against the | ||||
|     /// concurrency limit. | ||||
|     pub fn is_counted(&self) -> bool { | ||||
|         !self.is_pending_open && self.state.is_at_least_half_open() | ||||
|     } | ||||
|  | ||||
|     /// Returns true if stream is currently being held for some time because of | ||||
|     /// a local reset. | ||||
|     pub fn is_pending_reset_expiration(&self) -> bool { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user