Fix handling Streams.refs in next_incoming
				
					
				
			`Streams.inner.ref` doesn't need to be incremented if we don't return an `OpaqueStreamRef`. This prevented the bug in `send_push_promise` from appearing in the tests.
This commit is contained in:
		
				
					committed by
					
						 Sean McArthur
						Sean McArthur
					
				
			
			
				
	
			
			
			
						parent
						
							e3a358d696
						
					
				
				
					commit
					6d80bd454e
				
			| @@ -557,17 +557,16 @@ where | |||||||
|     pub fn next_incoming(&mut self) -> Option<StreamRef<B>> { |     pub fn next_incoming(&mut self) -> Option<StreamRef<B>> { | ||||||
|         let mut me = self.inner.lock().unwrap(); |         let mut me = self.inner.lock().unwrap(); | ||||||
|         let me = &mut *me; |         let me = &mut *me; | ||||||
|         let key = me.actions.recv.next_incoming(&mut me.store); |         me.actions.recv.next_incoming(&mut me.store).map(|key| { | ||||||
|         // TODO: ideally, OpaqueStreamRefs::new would do this, but we're holding |  | ||||||
|         // the lock, so it can't. |  | ||||||
|         me.refs += 1; |  | ||||||
|         key.map(|key| { |  | ||||||
|             let stream = &mut me.store.resolve(key); |             let stream = &mut me.store.resolve(key); | ||||||
|             tracing::trace!( |             tracing::trace!( | ||||||
|                 "next_incoming; id={:?}, state={:?}", |                 "next_incoming; id={:?}, state={:?}", | ||||||
|                 stream.id, |                 stream.id, | ||||||
|                 stream.state |                 stream.state | ||||||
|             ); |             ); | ||||||
|  |             // TODO: ideally, OpaqueStreamRefs::new would do this, but we're holding | ||||||
|  |             // the lock, so it can't. | ||||||
|  |             me.refs += 1; | ||||||
|             StreamRef { |             StreamRef { | ||||||
|                 opaque: OpaqueStreamRef::new(self.inner.clone(), stream), |                 opaque: OpaqueStreamRef::new(self.inner.clone(), stream), | ||||||
|                 send_buffer: self.send_buffer.clone(), |                 send_buffer: self.send_buffer.clone(), | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user