Stub out window update

This commit is contained in:
Carl Lerche
2017-07-08 22:36:24 -07:00
parent 981af88838
commit 6d1d54f104
3 changed files with 36 additions and 1 deletions

View File

@@ -34,6 +34,7 @@ mod reset;
mod settings;
mod stream_id;
mod util;
mod window_update;
pub use self::data::Data;
pub use self::go_away::GoAway;
@@ -43,6 +44,7 @@ pub use self::ping::Ping;
pub use self::reset::Reset;
pub use self::settings::{Settings, SettingSet};
pub use self::stream_id::StreamId;
pub use self::window_update::WindowUpdate;
// Re-export some constants
pub use self::settings::{

View File

@@ -0,0 +1,28 @@
use frame::{Head, Error};
use super::{StreamId};
#[derive(Debug)]
pub struct WindowUpdate {
stream_id: StreamId,
size_increment: u32,
}
const SIZE_INCREMENT_MASK: u32 = 1 << 31;
impl WindowUpdate {
pub fn load(head: Head, payload: &[u8]) -> Result<WindowUpdate, Error> {
if payload.len() != 4 {
// Invalid payload len
// TODO: Handle error
unimplemented!();
}
let size_increment = unpack_octets_4!(payload, 0, u32)
& !SIZE_INCREMENT_MASK;
Ok(WindowUpdate {
stream_id: head.stream_id(),
size_increment: size_increment,
})
}
}

View File

@@ -91,7 +91,12 @@ impl<T> FramedRead<T> {
debug!("decoded; frame={:?}", frame);
unimplemented!();
}
Kind::WindowUpdate => unimplemented!(),
Kind::WindowUpdate => {
// TODO: IMPLEMENT
let frame = try!(frame::WindowUpdate::load(head, &bytes[frame::HEADER_LEN..]));
debug!("decoded; frame={:?}", frame);
return Ok(None);
},
Kind::Continuation => {
unimplemented!();
}