implement h2::server::Stream::send_reset(Reason) and Body::is_empty() (#22)

This commit is contained in:
Oliver Gould
2017-08-23 12:48:00 -07:00
committed by Carl Lerche
parent e8f757457b
commit f839443ece
7 changed files with 87 additions and 3 deletions

View File

@@ -225,6 +225,16 @@ impl<B> Recv<B> where B: Buf {
Ok(())
}
pub fn body_is_empty(&self, stream: &store::Ptr<B>) -> bool {
if !stream.state.is_recv_closed() {
return false;
}
stream.pending_recv.peek_front(&self.buffer)
.map(|frame| !frame.is_data())
.unwrap_or(true)
}
pub fn recv_data(&mut self,
frame: frame::Data,
stream: &mut store::Ptr<B>)