Correctly notify StreamMultiplexer of SETTINGS changes. (#67)

Motivation:

The StreamMultiplexer and StreamChannels are responsible for sending
WINDOW_UPDATE frames, but they were never told if the user changed the
value of SETTINGS_INITIAL_WINDOW_SIZE. They should be.

Modifications:

- Send user events when SETTINGS_INITIAL_WINDOW_SIZE changes.
- Use those window events to change the target window size in
    HTTP2StreamChannel.
- Keep track of the last stream window size we knew.

Result:

Less chance of flow control mess.
This commit is contained in:
Cory Benfield authored and GitHub committed 2019-03-15 17:37:00 +00:00
1 parent 1138881931
commit 55daa4cd4e
9 files changed
+155 -8

No files matched your search

@@ -39,6 +39,9 @@ internal enum NIOHTTP2ConnectionStateChange: Hashable {
/// The remote peer's settings have been changed.
case remoteSettingsChanged(RemoteSettingsChanged)
/// The local peer's settings have been changed.
case localSettingsChanged(LocalSettingsChanged)
/// A stream has been created.
internal struct StreamCreated: Hashable {
internal var streamID: HTTP2StreamID
@@ -144,6 +147,14 @@ internal enum NIOHTTP2ConnectionStateChange: Hashable {
internal struct RemoteSettingsChanged: Hashable {
internal var streamWindowSizeChange: Int = 0
}
/// The local peer's settings have changed in a way that is not trivial to decode.
///
/// This object keeps track of the change on all stream window sizes via
/// SETTINGS frame.
internal struct LocalSettingsChanged: Hashable {
internal var streamWindowSizeChange: Int = 0
}
}