Documentation

Hale.Http2.Network.HTTP2.FlowControl

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

      Create a flow window with the default initial size (65535).

      Equations
      Instances For

        Create a flow window with a specific initial size.

        Equations
        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$$

            Equations
            Instances For

              Check if there is any space in the window for sending. $$\text{available}(w) = \max(0, w.\text{size})$$

              Equations
              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
                    • One or more equations did not get rendered due to their size.
                    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
                      Instances For

                        Record that we received data from the peer. Decrements the receive window.

                        Equations
                        Instances For

                          Record that we sent data. Decrements the send window.

                          Equations
                          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.
                            Instances For