Wire in recv flow control (#26)

This commit is contained in:
Carl Lerche
2017-08-23 11:22:24 -07:00
committed by GitHub
parent a623ab68b5
commit 807d2b7317
18 changed files with 452 additions and 345 deletions

View File

@@ -3,13 +3,20 @@ use frame::{self, Head, Error, Kind, StreamId};
use bytes::{BufMut, BigEndian};
#[derive(Debug)]
#[derive(Debug, Clone, Copy)]
pub struct GoAway {
last_stream_id: StreamId,
error_code: u32,
}
impl GoAway {
pub fn new(last_stream_id: StreamId, reason: Reason) -> Self {
GoAway {
last_stream_id,
error_code: reason.into(),
}
}
pub fn reason(&self) -> Reason {
self.error_code.into()
}

View File

@@ -165,6 +165,9 @@ pub enum Error {
/// An invalid setting value was provided
InvalidSettingValue,
/// An invalid window update value
InvalidWindowUpdateValue,
/// The payload length specified by the frame header was not the
/// value necessary for the specific frame type.
InvalidPayloadLength,

View File

@@ -38,7 +38,9 @@ impl WindowUpdate {
// when received.
let size_increment = unpack_octets_4!(payload, 0, u32) & !SIZE_INCREMENT_MASK;
// TODO: the size_increment must be greater than 0
if size_increment == 0 {
return Err(Error::InvalidWindowUpdateValue.into());
}
Ok(WindowUpdate {
stream_id: head.stream_id(),