mirror of
https://github.com/apple/swift-nio-http2
synced 2026-11-25 04:47:50 +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
@@ -231,7 +231,7 @@ final class HTTP2StreamChannel: Channel, ChannelCore {
|
||||
|
||||
private var state: StreamChannelState
|
||||
|
||||
private let windowManager: InboundWindowManager
|
||||
private var windowManager: InboundWindowManager
|
||||
|
||||
/// If close0 was called but the stream could not synchronously close (because it's currently
|
||||
/// active), the promise is stored here until it can be fulfilled.
|
||||
@@ -512,5 +512,14 @@ internal extension HTTP2StreamChannel {
|
||||
self.parent?.flush()
|
||||
}
|
||||
}
|
||||
|
||||
func initialWindowSizeChanged(delta: Int) {
|
||||
if let increment = self.windowManager.initialWindowSizeChanged(delta: delta) {
|
||||
let frame = HTTP2Frame(streamID: self.streamID, payload: .windowUpdate(windowSizeIncrement: increment))
|
||||
self.receiveOutboundFrame(frame, promise: nil)
|
||||
// This flush should really go away, but we need it for now until we sort out window management.
|
||||
self.parent?.flush()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user