This change adds a .rustfmt.toml that includes ALL supported settings,
12 of which we have overridden to attempt to cater to our own
proclivities.
rustfmt is checked in the rust-nightly CI job.
This patch does a bunch of refactoring, mostly around error types, but it also
paves the way to allow `Codec` to be used standalone.
* `Codec` (and `FramedRead` / `FramedWrite`) is broken out into a codec module.
* An h2-codec crate is created that re-exports the frame and codec modules.
* New error types are introduced in the internals:
* `RecvError` represents errors caused by trying to receive a frame.
* `SendError` represents errors caused by trying to send a frame.
* `UserError` is an enum of potential errors caused by invalid usage
by the user of the lib.
* `ProtoError` is either a `Reason` or an `io::Error`. However it doesn't
specify connection or stream level.
* `h2::Error` is an opaque error type and is the only error type exposed
by the public API (used to be `ConnectionError`).
There are misc code changes to enable this as well. The biggest is a new "sink"
API for `Codec`. It provides buffer which queues up a frame followed by flush
which writes everything that is queued. This departs from the `Sink` trait in
order to provide more accurate error values. For example, buffer can never fail
(but it will panic if `poll_ready` is not called first).
ControlFlow::poll_window_update now exposes, effectively, a Stream of
WindowUpdates. Callers no longer poll on invidual stream IDs. To
accomplish this, FlowControl maintains a queue of pending remote stream
ids.
Improve/shorten naming throughout FlowControl.
FlowControlState::check_window has been added so that FlowControl is now
consistent in the face of stream-level flow control errors.
Connection now exposes the ControlFlow functions without exposing the
ControlFlow interface publicly.
introduce the StreamTransporter trait, which exposes a map containing
all active stream states.
add skeletons for StreamTracker and FlowControl. StreamTracker drives
all state changes
* 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