wip: Sketch out stream state refactor

introduce the StreamTransporter trait, which exposes a map containing
all active stream states.

add skeletons for StreamTracker and FlowControl.  StreamTracker drives
all state changes
This commit is contained in:
Oliver Gould
2017-07-15 18:39:45 +00:00
parent d0c55c52e9
commit 1ed4b7e56a
8 changed files with 270 additions and 141 deletions

View File

@@ -20,7 +20,11 @@ impl<T, U> PingPong<T, U>
pong: None,
}
}
}
impl<T, U> PingPong<T, U>
where T: Sink<SinkItem = Frame<U>, SinkError = ConnectionError>,
{
fn try_send_pong(&mut self) -> Poll<(), ConnectionError> {
if let Some(pong) = self.pong.take() {
if let AsyncSink::NotReady(pong) = self.inner.start_send(pong)? {
@@ -77,8 +81,7 @@ impl<T, U> Stream for PingPong<T, U>
}
impl<T, U> Sink for PingPong<T, U>
where T: Stream<Item = Frame, Error = ConnectionError>,
T: Sink<SinkItem = Frame<U>, SinkError = ConnectionError>,
where T: Sink<SinkItem = Frame<U>, SinkError = ConnectionError>,
{
type SinkItem = Frame<U>;
type SinkError = ConnectionError;
@@ -103,8 +106,7 @@ impl<T, U> Sink for PingPong<T, U>
}
impl<T, U> ReadySink for PingPong<T, U>
where T: Stream<Item = Frame, Error = ConnectionError>,
T: Sink<SinkItem = Frame<U>, SinkError = ConnectionError>,
where T: Sink<SinkItem = Frame<U>, SinkError = ConnectionError>,
T: ReadySink,
{
fn poll_ready(&mut self) -> Poll<(), ConnectionError> {