implement h2::server::Stream::send_reset(Reason) and Body::is_empty() (#22)
This commit is contained in:
		
				
					committed by
					
						 Carl Lerche
						Carl Lerche
					
				
			
			
				
	
			
			
			
						parent
						
							e8f757457b
						
					
				
				
					commit
					f839443ece
				
			| @@ -1,4 +1,5 @@ | ||||
| use {frame, ConnectionError}; | ||||
| use error::User::InactiveStreamId; | ||||
| use proto::*; | ||||
| use super::*; | ||||
|  | ||||
| @@ -108,6 +109,23 @@ impl<B> Send<B> where B: Buf { | ||||
|         stream.state.send_close() | ||||
|     } | ||||
|  | ||||
|     pub fn send_reset(&mut self, reason: Reason, | ||||
|                       stream: &mut store::Ptr<B>, | ||||
|                       task: &mut Option<Task>) | ||||
|         -> Result<(), ConnectionError> | ||||
|     { | ||||
|         if stream.state.is_closed() { | ||||
|             return Err(InactiveStreamId.into()) | ||||
|         } | ||||
|  | ||||
|         stream.state.send_reset(reason)?; | ||||
|  | ||||
|         let frame = frame::Reset::new(stream.id, reason); | ||||
|         self.prioritize.queue_frame(frame.into(), stream, task); | ||||
|  | ||||
|         Ok(()) | ||||
|     } | ||||
|  | ||||
|     pub fn send_data(&mut self, | ||||
|                      frame: frame::Data<B>, | ||||
|                      stream: &mut store::Ptr<B>, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user