Wire up trailers

This commit is contained in:
Carl Lerche
2017-08-10 20:24:52 -07:00
parent 48c9734249
commit 10fd4ae7ed
2 changed files with 15 additions and 8 deletions

View File

@@ -146,10 +146,20 @@ impl<B> Recv<B> where B: Buf {
Ok(()) Ok(())
} }
pub fn recv_eos(&mut self, stream: &mut Stream<B>) /// Transition the stream based on receiving trailers
pub fn recv_trailers<P: Peer>(&mut self,
frame: frame::Headers,
stream: &mut store::Ptr<B>)
-> Result<(), ConnectionError> -> Result<(), ConnectionError>
{ {
stream.state.recv_close() // Transition the state
stream.state.recv_close();
// Push the frame onto the stream's recv buffer
stream.pending_recv.push_back(&mut self.buffer, frame.into());
stream.notify_recv();
Ok(())
} }
pub fn recv_data(&mut self, pub fn recv_data(&mut self,

View File

@@ -91,15 +91,12 @@ impl<B> Streams<B>
me.actions.transition::<P, _, _>(stream, |actions, stream| { me.actions.transition::<P, _, _>(stream, |actions, stream| {
if frame.is_trailers() { if frame.is_trailers() {
unimplemented!();
/*
if !frame.is_end_stream() { if !frame.is_end_stream() {
// TODO: What error should this return? // TODO: Is this the right error
unimplemented!(); return Err(ProtocolError.into());
} }
try!(me.actions.recv.recv_eos(stream)); actions.recv.recv_trailers::<P>(frame, stream)
*/
} else { } else {
actions.recv.recv_headers::<P>(frame, stream) actions.recv.recv_headers::<P>(frame, stream)
} }