Fix stream-id double-accounting bug (#112)
Both Recv::open and Rev::recv_headers check new stream ids against the previously stream id. The second such check fails. Now, only Recv::open performs stream id checks. Fixes #110
This commit is contained in:
		
				
					committed by
					
						 Carl Lerche
						Carl Lerche
					
				
			
			
				
	
			
			
			
						parent
						
							8911ee2a4b
						
					
				
				
					commit
					0b289fd55d
				
			| @@ -137,13 +137,6 @@ where | ||||
|         let is_initial = stream.state.recv_open(frame.is_end_stream())?; | ||||
|  | ||||
|         if is_initial { | ||||
|             let next_id = self.next_stream_id()?; | ||||
|             if frame.stream_id() >= next_id { | ||||
|                 self.next_stream_id = frame.stream_id().next_id(); | ||||
|             } else { | ||||
|                 return Err(RecvError::Connection(ProtocolError)); | ||||
|             } | ||||
|  | ||||
|             // TODO: be smarter about this logic | ||||
|             if frame.stream_id() > self.last_processed_id { | ||||
|                 self.last_processed_id = frame.stream_id(); | ||||
|   | ||||
| @@ -116,10 +116,9 @@ impl State { | ||||
|         return Ok(()); | ||||
|     } | ||||
|  | ||||
|     /// Open the receive have of the stream, this action is taken when a HEADERS | ||||
|     /// frame is received. | ||||
|     /// Opens the receive-half of the stream when a HEADERS frame is received. | ||||
|     /// | ||||
|     /// Returns true if this transitions the state to Open | ||||
|     /// Returns true if this transitions the state to Open. | ||||
|     pub fn recv_open(&mut self, eos: bool) -> Result<bool, RecvError> { | ||||
|         let remote = Peer::Streaming; | ||||
|         let mut initial = false; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user