Track http crate changes

This commit is contained in:
Carl Lerche
2017-08-03 10:00:50 -07:00
parent 9f9bf85168
commit e810b30999
6 changed files with 49 additions and 47 deletions

View File

@@ -174,7 +174,7 @@ impl<T, P, B> Connection<T, P, B>
// Update stream state while ensuring that the headers frame
// can be received.
if let Some(frame) = try!(self.streams.recv_headers(frame)) {
let frame = Self::convert_poll_message(frame);
let frame = Self::convert_poll_message(frame)?;
return Ok(Some(frame).into());
}
}
@@ -227,18 +227,18 @@ impl<T, P, B> Connection<T, P, B>
}
}
fn convert_poll_message(frame: frame::Headers) -> Frame<P::Poll> {
fn convert_poll_message(frame: frame::Headers) -> Result<Frame<P::Poll>, ConnectionError> {
if frame.is_trailers() {
Frame::Trailers {
Ok(Frame::Trailers {
id: frame.stream_id(),
headers: frame.into_fields()
}
})
} else {
Frame::Headers {
Ok(Frame::Headers {
id: frame.stream_id(),
end_of_stream: frame.is_end_stream(),
headers: P::convert_poll_message(frame),
}
headers: P::convert_poll_message(frame)?,
})
}
}
}

View File

@@ -13,7 +13,7 @@ use self::ping_pong::PingPong;
use self::settings::Settings;
use self::streams::Streams;
use StreamId;
use {StreamId, ConnectionError};
use error::Reason;
use frame::{self, Frame};
@@ -39,7 +39,7 @@ pub trait Peer {
end_of_stream: bool) -> frame::Headers;
#[doc(hidden)]
fn convert_poll_message(headers: frame::Headers) -> Self::Poll;
fn convert_poll_message(headers: frame::Headers) -> Result<Self::Poll, ConnectionError>;
}
pub type PingPayload = [u8; 8];