Implement ping_pong (#1)

* comments

* wip

* wip

* Sketch out pingpong and keepalive stack modules

PingPong responds to ping requests with acknowledgements.
KeepAlive issues ping requests on idle connections.

* remove keepalive for now

* commentary

* prettify ping_pong's poll

* test ping pong and passthrough

* add buffering test

* Use a fixed-size slice for ping payloads

* Improve pong dispatch

pong messages should be buffered until Stream::poll returns
Async::NotReady or Async::Ready(None) (i.e. such that it is not expected
to be polled again).  pong messages are now dispatched when no more data
may be polled or the Sink half is activated.

* revert name change

* touchup

* wip

* Simplify Stream::poll

Now PingPong only holds at most one pending pong and the stream will not
produce additional frames unti the ping has been sent.

Furthermore, we shouldn't have to call inner.poll_complete quite so
frequently.

* avoid Bytes::split_to

* only use buf internally to Ping::load
This commit is contained in:
Oliver Gould
2017-06-30 13:58:14 -07:00
committed by Carl Lerche
parent a7b92d5ec2
commit 7f21954724
8 changed files with 334 additions and 11 deletions

View File

@@ -90,7 +90,7 @@ pub fn parse_stream_id(buf: &[u8]) -> StreamId {
impl Kind {
pub fn new(byte: u8) -> Kind {
return match byte {
match byte {
0 => Kind::Data,
1 => Kind::Headers,
2 => Kind::Priority,