╭ changed ─────────────────╮ │src/serve_ssh_protocol.zig│ ╰──────────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────╮ │← previous│ ╰──────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │1976 } │ │1977 │ │1978 /// Send a CHANNEL_WINDOW_ADJUST if our receive window has dipped below half│ │1899 -/// of the initial value. Used both for the pre-session discard path and by │ │1900 -/// SessionCtx after it consumes a CHANNEL_DATA payload. │ │1901 -fn maybeRefillRecvWindow(conn: *Conn, ch: *Channel) !void { │ │1902 - if (ch.local_window >= initial_recv_window / 2) return; │ │1903 - const add = initial_recv_window - ch.local_window; │ │1979 +/// of `budget`, the credit we're willing to have outstanding. Used both for│ │1980 +/// the pre-session discard path and by SessionCtx after it consumes a │ │1981 +/// CHANNEL_DATA payload. │ │1982 +fn maybeRefillRecvWindow(conn: *Conn, ch: *Channel, budget: u32) !void { │ │1983 + if (ch.local_window >= budget / 2) return; │ │1984 + const add = budget - ch.local_window; │ │1985 ch.local_window += add; │ │1986 var adj: std.ArrayList(u8) = .empty; │ │1987 defer adj.deinit(conn.allocator); │ ╰──────────────────────────────────────────────────────────────────────────────────╯