WIP: send flow control

This commit is contained in:
Carl Lerche
2017-08-09 14:16:32 -07:00
parent 87c4d36b0c
commit dfec401fdf
9 changed files with 170 additions and 89 deletions

View File

@@ -1,7 +1,7 @@
use hpack;
use error::{ConnectionError, Reason};
use bytes::Bytes;
use bytes::{Bytes, Buf};
use std::fmt;
@@ -78,6 +78,18 @@ impl<T> Frame<T> {
}
}
impl<T: Buf> Frame<T> {
/// Returns the length of the frame as it applies to flow control.
pub fn flow_len(&self) -> usize {
use self::Frame::*;
match *self {
Data(ref frame) => frame.payload().remaining(),
_ => 0,
}
}
}
impl<T> fmt::Debug for Frame<T> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
use self::Frame::*;