Flow control window state for a connection or stream.
$$\text{FlowWindow} = \{ \text{size} : \mathbb{Z} \mid \text{size} \leq 2^{31} - 1 \}$$
Window sizes can go negative when the peer changes SETTINGS_INITIAL_WINDOW_SIZE.
- size : Int
Current window size. Can be negative.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Equations
Equations
Instances For
Equations
Equations
- Network.HTTP2.instBEqFlowWindow.beq { size := a } { size := b } = (a == b)
- Network.HTTP2.instBEqFlowWindow.beq x✝¹ x✝ = false
Instances For
Create a flow window with the default initial size (65535).
Equations
- Network.HTTP2.FlowWindow.default = { size := 65535 }
Instances For
Create a flow window with a specific initial size.
Equations
- Network.HTTP2.FlowWindow.ofSize n = { size := n }
Instances For
Apply a WINDOW_UPDATE increment. Returns an error if the result would exceed the maximum window size (2^31 - 1).
$$\text{increment}(w, i) = \begin{cases} \text{ok}(w + i) & \text{if } w + i \leq 2^{31} - 1 \\ \text{error} & \text{otherwise} \end{cases}$$
Equations
- One or more equations did not get rendered due to their size.
Instances For
Consume bytes from the window (when sending data). $$\text{consume}(w, n) = w - n$$
Instances For
Adjust the window when SETTINGS_INITIAL_WINDOW_SIZE changes. Per RFC 9113 Section 6.9.2: the difference between new and old initial window size is applied to all existing streams.
$$\text{adjust}(w, \text{old}, \text{new}) = w + (\text{new} - \text{old})$$
Equations
- One or more equations did not get rendered due to their size.
Instances For
Connection-level flow control state.
- sendWindow : FlowWindow
Send window (how much we can send).
- recvWindow : FlowWindow
Receive window (how much peer can send to us).
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Instances For
Create default connection flow control.
Equations
- Network.HTTP2.ConnectionFlowControl.default = { sendWindow := Network.HTTP2.FlowWindow.default, recvWindow := Network.HTTP2.FlowWindow.default }
Instances For
Process a received WINDOW_UPDATE for the connection (stream 0). $$\text{processWindowUpdate} : \text{ConnectionFlowControl} \to \text{UInt32} \to \text{Except}(\text{ErrorCode}, \text{ConnectionFlowControl})$$
Equations
- fc.processWindowUpdate increment = match fc.sendWindow.increment increment with | Except.ok w => Except.ok { sendWindow := w, recvWindow := fc.recvWindow } | Except.error e => Except.error e
Instances For
Record that we received data from the peer. Decrements the receive window.
Equations
- fc.consumeRecv bytes = { sendWindow := fc.sendWindow, recvWindow := fc.recvWindow.consume bytes }
Instances For
Record that we sent data. Decrements the send window.
Equations
- fc.consumeSend bytes = { sendWindow := fc.sendWindow.consume bytes, recvWindow := fc.recvWindow }
Instances For
Process a WINDOW_UPDATE for a specific stream. Updates the stream's send window in the given StreamInfo.
Equations
- One or more equations did not get rendered due to their size.