wire up flow control polling through connection

This commit is contained in:
Oliver Gould
2017-07-16 16:04:40 +00:00
parent 85626f5a79
commit 76dbb5d285
8 changed files with 207 additions and 156 deletions

View File

@@ -1,3 +1,12 @@
use {frame, ConnectionError, Peer, StreamId};
use bytes::{Buf, IntoBuf};
use fnv::FnvHasher;
use futures::*;
use ordermap::{Entry, OrderMap};
use std::hash::BuildHasherDefault;
use tokio_io::{AsyncRead, AsyncWrite};
use tokio_io::codec::length_delimited;
mod connection;
mod flow_control;
mod flow_controller;
@@ -20,17 +29,6 @@ pub use self::settings::Settings;
pub use self::stream_tracker::StreamTracker;
use self::state::StreamState;
use {frame, ConnectionError, Peer, StreamId};
use tokio_io::{AsyncRead, AsyncWrite};
use tokio_io::codec::length_delimited;
use bytes::{Buf, IntoBuf};
use ordermap::{Entry, OrderMap};
use fnv::FnvHasher;
use std::hash::BuildHasherDefault;
/// Represents the internals of an HTTP2 connection.
///
/// A transport consists of several layers (_transporters_) and is arranged from _top_
@@ -100,7 +98,7 @@ impl StreamMap {
}
/// Allows settings to be applied from the top of the stack to the lower levels.d
pub trait ConnectionTransporter {
pub trait ApplySettings {
fn apply_local_settings(&mut self, set: &frame::SettingSet) -> Result<(), ConnectionError>;
fn apply_remote_settings(&mut self, set: &frame::SettingSet) -> Result<(), ConnectionError>;
}
@@ -110,6 +108,11 @@ pub trait StreamTransporter {
fn streams_mut(&mut self) -> &mut StreamMap;
}
pub trait FlowTransporter {
fn poll_remote_window_update(&mut self, id: StreamId) -> Poll<WindowSize, ConnectionError>;
fn grow_local_window(&mut self, id: StreamId, incr: WindowSize) -> Result<(), ConnectionError>;
}
/// Create a full H2 transport from an I/O handle.
///
/// This is called as the final step of the client handshake future.