Commit Graph

18 Commits

Author SHA1 Message Date
Oliver Gould
897bf84163 Use rustfmt to enforce consistent formatting
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.
2017-09-12 22:29:35 +00:00
Carl Lerche
5c0efcf8c4 Ref count stream state and release when final (#73)
Previously, stream state was never released so that long-lived connections
leaked memory.

Now, stream states are reference-counted and freed from the stream slab
when complete.  Locally reset streams are retained so that received frames
may be ignored.
2017-09-10 16:01:19 -07:00
Carl Lerche
c122e97127 Refactor errors (#46)
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).
2017-09-02 11:12:50 -07:00
Carl Lerche
b0e6867877 Fix warnings 2017-08-24 15:52:01 -07:00
Carl Lerche
807d2b7317 Wire in recv flow control (#26) 2017-08-23 11:22:24 -07:00
Carl Lerche
8a15663ed2 Progress towards allowing large writes 2017-08-11 16:57:51 -07:00
Carl Lerche
71acfe3961 Start hooking up data receiving 2017-08-07 12:17:52 -07:00
Carl Lerche
fc0a7eb898 More work 2017-08-04 12:12:22 -07:00
Carl Lerche
74b3852a58 Start working on prioritization 2017-08-03 22:44:19 -07:00
Carl Lerche
dd8412d660 Much work 2017-08-03 15:50:13 -07:00
Carl Lerche
7a804601c5 A lot of structural work 2017-08-03 11:40:50 -07:00
Carl Lerche
9f9bf85168 More restructuring 2017-08-02 14:48:10 -07:00
Carl Lerche
77681674e2 Start prepping for Sync 2017-08-02 13:43:14 -07:00
Carl Lerche
9d7221e6cf Misc streams cleanup 2017-08-02 13:09:14 -07:00
Carl Lerche
22ebf186c6 Move state into proto::streams 2017-08-02 12:57:49 -07:00
Carl Lerche
341e15769e Move to custom stream storage 2017-08-02 12:55:41 -07:00
Carl Lerche
a3cbf2d7ac Wire up Trailers frame 2017-08-02 11:34:34 -07:00
Carl Lerche
33bdc057d6 Restructure proto
The existing code has been moved out and is being copied back piece / by
piece while restructuring the code to (hopefully) be more manageable.
2017-08-02 09:42:10 -07:00