Make 'pending reset' streams not count towards active streams
This commit is contained in:
		| @@ -173,7 +173,7 @@ where | ||||
|     pub fn maybe_close_connection_if_no_streams(&mut self) { | ||||
|         // If we poll() and realize that there are no streams or references | ||||
|         // then we can close the connection by transitioning to GOAWAY | ||||
|         if self.streams.num_active_streams() == 0 && !self.streams.has_streams_or_other_references() { | ||||
|         if !self.streams.has_streams_or_other_references() { | ||||
|             self.go_away_now(Reason::NO_ERROR); | ||||
|         } | ||||
|     } | ||||
| @@ -202,7 +202,7 @@ where | ||||
|                             try_ready!(self.streams.poll_complete(&mut self.codec)); | ||||
|  | ||||
|                             if self.error.is_some() || self.go_away.should_close_on_idle() { | ||||
|                                 if self.streams.num_active_streams() == 0 { | ||||
|                                 if !self.streams.has_streams() { | ||||
|                                     self.go_away_now(Reason::NO_ERROR); | ||||
|                                     continue; | ||||
|                                 } | ||||
|   | ||||
| @@ -147,7 +147,6 @@ impl Counts { | ||||
|         if stream.is_closed() { | ||||
|             if !stream.is_pending_reset_expiration() { | ||||
|                 stream.unlink(); | ||||
|  | ||||
|                 if is_reset_counted { | ||||
|                     self.dec_num_reset_streams(); | ||||
|                 } | ||||
|   | ||||
| @@ -193,6 +193,7 @@ impl ops::IndexMut<Key> for Store { | ||||
| } | ||||
|  | ||||
| impl Store { | ||||
|     #[cfg(feature = "unstable")] | ||||
|     pub fn num_active_streams(&self) -> usize { | ||||
|         self.ids.len() | ||||
|     } | ||||
|   | ||||
| @@ -746,11 +746,17 @@ where | ||||
|         Ok(()) | ||||
|     } | ||||
|  | ||||
|     #[cfg(feature = "unstable")] | ||||
|     pub fn num_active_streams(&self) -> usize { | ||||
|         let me = self.inner.lock().unwrap(); | ||||
|         me.store.num_active_streams() | ||||
|     } | ||||
|  | ||||
|     pub fn has_streams(&self) -> bool { | ||||
|         let me = self.inner.lock().unwrap(); | ||||
|         me.counts.has_streams() | ||||
|     } | ||||
|  | ||||
|     pub fn has_streams_or_other_references(&self) -> bool { | ||||
|         let me = self.inner.lock().unwrap(); | ||||
|         me.counts.has_streams() || me.refs > 1 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user