wip: refactor, compiles
This commit is contained in:
@@ -80,6 +80,21 @@ impl<T> Frame<T> {
|
||||
&Settings(_) => StreamId::zero(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_end_stream(&self) -> bool {
|
||||
use self::Frame::*;
|
||||
|
||||
match self {
|
||||
&Headers(ref v) => v.is_end_stream(),
|
||||
&Data(ref v) => v.is_end_stream(),
|
||||
&Reset(ref v) => true,
|
||||
|
||||
&PushPromise(_) |
|
||||
&WindowUpdate(_) |
|
||||
&Ping(_) |
|
||||
&Settings(_) => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Errors that can occur during parsing an HTTP/2 frame.
|
||||
|
||||
@@ -16,6 +16,15 @@ impl Reset {
|
||||
error_code: error.into(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn stream_id(&self) -> StreamId {
|
||||
self.stream_id
|
||||
}
|
||||
|
||||
pub fn reason(&self) -> Reason {
|
||||
self.error_code.into()
|
||||
}
|
||||
|
||||
pub fn load(head: Head, payload: &[u8]) -> Result<Reset, Error> {
|
||||
if payload.len() != 4 {
|
||||
return Err(Error::InvalidPayloadLength);
|
||||
@@ -35,14 +44,6 @@ impl Reset {
|
||||
head.encode(4, dst);
|
||||
dst.put_u32::<BigEndian>(self.error_code);
|
||||
}
|
||||
|
||||
pub fn stream_id(&self) -> StreamId {
|
||||
self.stream_id
|
||||
}
|
||||
|
||||
pub fn reason(&self) -> Reason {
|
||||
self.error_code.into()
|
||||
}
|
||||
}
|
||||
|
||||
impl<B> From<Reset> for frame::Frame<B> {
|
||||
|
||||
Reference in New Issue
Block a user