Skip to content

Flow control support - part 1#26

Open
mlalic wants to merge 12 commits into
masterfrom
flow-ctrl
Open

Flow control support - part 1#26
mlalic wants to merge 12 commits into
masterfrom
flow-ctrl

Conversation

@mlalic

@mlalic mlalic commented Apr 25, 2016

Copy link
Copy Markdown
Owner

This PR adds full support for flow control window updates on the connection and session layers.

The HttpConnection struct has grown methods for sending window updates to the peer, as well as for updating the connection-level inbound flow control.

Additionally, it now notifies the Session on all flow control updates. Previously, it would track the connection-level window size, but the Session would need to ask for its size, while there was no support for stream-level flow control.

Finally, window updates (from WINDOW_UPDATE frames) are propagated up to the Session.

This PR also adds support for client-side inbound flow control to the default session layer implementation.

Future work includes having the default session layer honor the outbound flow control on all its streams (currently, although it is notified of outbound stream window updates, they are completely ignored).

mlalic added 12 commits April 24, 2016 17:47
This allows `WindowSize`s to be compared for equality against `i32`s
transparently...
… size methods

There is no point in coercing the internal `WindowSize` struct into an `i32`
before returning it; in fact, this can easily be done by clients if they have
such a requirement.
This commit adds two methods to the `Session` trait that allow it to be
notified when a new WINDOW_UPDATE frame signals an increase in the outbound
window size for both the connection-level, as well as the stream-level
windows.
Two new methods are added to the `Session` trait that allow it to
receive notice when either the connection-level or a stream-level
inbound window size decreases. These calls will, as a rule, always
be emitted in pairs by the `HttpConnection` upon parsing a flow-control
subject frame (at the moment this is only the DATA frame, as per the
HTTP/2 spec).
The state now has an entry per stream, instead of storing just the raw
stream. This is in preparation for extending the state to be able to
track more stream-related information, that does not belong on the
Stream trait itself.

(The Stream trait is supposed to be the bridge between the session and
its client that is interested only in stream-level events; requiring
those clients to also implement tracking various book-keeping stream
state is not only redundant---all streams will need to track the same
state in the same way---but also not in line with what the Stream trait
is supposed to represent.)
The method is used to signal errors that the local peer detects, in
contrast to those that the remote signals by sending an RST_STREAM
frame.  The Session should send the RST_STREAM after the
`on_stream_error` is called.
The mod.rs file was getting quite large...
The WindowUpdateStrategy trait is used to define the algorithm for
updating the flow control window of both the connection, as well as
individual stream.

The object is provided the new size of the corresponding window and
is expected to produce an action to be taken immediately: either
increase the size of the window or do nothing.
@mlalic

mlalic commented Apr 25, 2016

Copy link
Copy Markdown
Owner Author

/cc @jwilm

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.04%) to 94.196% when pulling 434a1d5 on flow-ctrl into 6d47da2 on master.

@rohitjoshi

Copy link
Copy Markdown

@mlalic when are we merging to mainline?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants