mirror of
https://github.com/apple/swift-nio-http2
synced 2026-11-24 04:38:00 +00:00
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:
1 parent
1138881931
commit
55daa4cd4e
9 files changed
+155
-8
No files matched your search
@@ -37,6 +37,8 @@ extension HasLocalSettings {
|
||||
swap(&temporarySettings, &self.localSettings)
|
||||
}
|
||||
|
||||
var effect = NIOHTTP2ConnectionStateChange.LocalSettingsChanged()
|
||||
|
||||
do {
|
||||
try temporarySettings.receiveSettingsAck { (setting, originalValue, newValue) in
|
||||
switch setting {
|
||||
@@ -56,6 +58,10 @@ extension HasLocalSettings {
|
||||
try self.streamState.forAllStreams {
|
||||
try $0.localInitialWindowSizeChanged(by: delta)
|
||||
}
|
||||
|
||||
// We do a += here because the value may change multiple times in one settings block. This way, we correctly
|
||||
// respect that possibility.
|
||||
effect.streamWindowSizeChange += Int(delta)
|
||||
case .maxFrameSize:
|
||||
// TODO(cory): Implement!
|
||||
break
|
||||
@@ -64,7 +70,7 @@ extension HasLocalSettings {
|
||||
return
|
||||
}
|
||||
}
|
||||
return .init(result: .succeed, effect: nil)
|
||||
return .init(result: .succeed, effect: .localSettingsChanged(effect))
|
||||
} catch {
|
||||
return .init(result: .connectionError(underlyingError: error, type: .protocolError), effect: nil)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user