Commit Graph

39 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
0cc611df35 Add Codec::set_max_send_frame_size 2017-09-05 14:01:32 -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
9bb34d907a Thread P generic through all 2017-08-30 18:16:21 -04:00
Carl Lerche
14f35f1be6 Handle malformed HEADERS 2017-08-30 18:16:21 -04:00
Carl Lerche
0c8a94aa11 Fix send flow control bug
The send stream state is transitioned before data is buffered. As such,
the stream state could be closed while there is still data to be sent.
2017-08-30 18:16:21 -04:00
Carl Lerche
b0e6867877 Fix warnings 2017-08-24 15:52:01 -07:00
Carl Lerche
de96b2f410 Add another test 2017-08-16 12:43:48 -07:00
Carl Lerche
8a15663ed2 Progress towards allowing large writes 2017-08-11 16:57:51 -07:00
Carl Lerche
32d4c2d5a9 Many more changes 2017-08-11 12:00:22 -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
Oliver Gould
1dbbac2c00 split FlowControl into FlowControlRecv and FlowControlSend 2017-07-24 22:01:16 +00:00
Oliver Gould
5b3f27c5fa Use macros for proxying internal interfaces. 2017-07-23 19:18:14 +00:00
Oliver Gould
df5f31a63c narrow the surface area of the ControlSettings api to expose only a few remote settings 2017-07-23 18:34:50 +00:00
Oliver Gould
55465a5954 settings todo 2017-07-22 21:17:57 +00:00
Oliver Gould
d7042097c4 wip: stream open 2017-07-21 16:35:00 +00:00
Oliver Gould
a62d3dda54 wip: refactor, compiles 2017-07-20 14:51:27 +00:00
Oliver Gould
0d84c98c89 wip 2017-07-19 19:53:33 +00:00
Oliver Gould
df589f2fde Address feedback on ControlFlow and FlowControl
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.
2017-07-18 22:36:41 +00:00
Oliver Gould
79d3aee1dc refuse streams that would violate max concurrency settings.
improve ping control API
2017-07-17 22:18:03 +00:00
Oliver Gould
fb4f0bc5af resets too 2017-07-17 08:18:38 +00:00
Oliver Gould
d448c53472 expose a ControlPing api
document transports

properly handle connection flow control tracking.
2017-07-16 23:37:31 +00:00
Oliver Gould
06d9978c53 nit on naming 2017-07-16 17:08:39 +00:00
Oliver Gould
76dbb5d285 wire up flow control polling through connection 2017-07-16 16:10:01 +00:00
Oliver Gould
59c92e1089 wire up remote settings application 2017-07-15 21:07:21 +00:00
Oliver Gould
d0c55c52e9 clarify terminology and fix several obvious bugs in the process 2017-07-13 06:43:28 +00:00
Oliver Gould
cc97653fd7 hmmmmm two tests are failing... handshake and get_with_204_response 2017-07-13 03:47:31 +00:00
Oliver Gould
41ffd1d44f closer to flow control 2017-07-12 21:04:58 +00:00
Carl Lerche
981af88838 Get data frames working 2017-07-08 22:23:44 -07:00
Carl Lerche
cb5130e3c6 Start working on server 2017-06-30 14:36:13 -07:00
Carl Lerche
63ffea61f5 Start writing tests 2017-06-29 20:59:21 -07:00
Carl Lerche
0564747121 Tweaks 2017-06-29 20:41:46 -07:00
Carl Lerche
8e16e22172 question... 2017-06-27 12:49:27 -07:00
Carl Lerche
79aa11ad32 Shuffle types around 2017-06-27 11:04:36 -07:00
Carl Lerche
7897b770e9 Get a request sent 2017-06-26 22:25:25 -07:00
Carl Lerche
ac2959e956 Get settings handshake working + other junk 2017-06-23 15:51:00 -07:00
Carl Lerche
fa21970656 Much work 2017-06-23 13:13:50 -07:00
Carl Lerche
f19f039bbc WIP 2017-03-10 18:38:06 -08:00
Carl Lerche
0e35254bd8 WIP 2017-03-10 15:14:55 -08:00