╭──────────╮ │← previous│ ╰──────────╯ ╭ changed ─────────────────╮ │src/serve_ssh_protocol.zig│ ╰──────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────╮ │1948 │ │1949 if (data_len > ch.local_window) return error.WindowExceeded; │ │1950 ch.local_window -= data_len; │ │1871 - try maybeRefillRecvWindow(conn, ch); │ │1951 + try maybeRefillRecvWindow(conn, ch, initial_recv_window); │ │1952 } │ │1953 │ │1954 pub fn parseChannelData(packet: []const u8, extended: bool, expected_channel: u32) ![]const u8 {│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │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); │ ╰──────────────────────────────────────────────────────────────────────────────────╯