diff --git a/src/proto/streams/recv.rs b/src/proto/streams/recv.rs index 4fb1b59..d0a66eb 100644 --- a/src/proto/streams/recv.rs +++ b/src/proto/streams/recv.rs @@ -146,10 +146,20 @@ impl Recv where B: Buf { Ok(()) } - pub fn recv_eos(&mut self, stream: &mut Stream) + /// Transition the stream based on receiving trailers + pub fn recv_trailers(&mut self, + frame: frame::Headers, + stream: &mut store::Ptr) -> 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, diff --git a/src/proto/streams/streams.rs b/src/proto/streams/streams.rs index bfa6fa0..0c969bf 100644 --- a/src/proto/streams/streams.rs +++ b/src/proto/streams/streams.rs @@ -91,15 +91,12 @@ impl Streams me.actions.transition::(stream, |actions, stream| { if frame.is_trailers() { - unimplemented!(); - /* if !frame.is_end_stream() { - // TODO: What error should this return? - unimplemented!(); + // TODO: Is this the right error + return Err(ProtocolError.into()); } - try!(me.actions.recv.recv_eos(stream)); - */ + actions.recv.recv_trailers::

(frame, stream) } else { actions.recv.recv_headers::

(frame, stream) }