Wire in recv flow control (#26)
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user