https://gitlab.synchro.net/main/sbbs/-/commit/833782b7cf66d42afe3c3b66
Modified Files:
src/syncterm/ssh.c ssh.h term.c wren_bind_conn.c
Log Message:
SyncTERM: keep Wren and inline transfers from fighting each other
Two interacting changes that came out of asking "what happens to the
SFTP queue if the user starts a zmodem download mid-transfer":
SO_SNDBUF mode-switching:
Connect-time SO_SNDBUF is now 1 MiB (consistent baseline across
platforms — Windows in particular defaults small). ssh.c gains
ssh_set_sftp_buffer_mode(bool) which drops the cap to 64 KiB while
CTerm.sftpActive is set and restores 1 MiB when the queue idles.
Inline transfers (zmodem/ymodem-G) get full BDP headroom (~1.6 Gbps
at 5 ms RTT); SFTP-active periods stay capped so a saturating
upload can't queue more than one keystroke-budget's worth of data
ahead of an interactive keystroke. fn_CTerm_sftpActive_set
short-circuits same-value sets so a tight queue run that stays
active across back-to-back jobs doesn't flap the kernel buffer.
Wren pump during inline transfers:
doterm() can't drive wren_result_drain / timers / hook dispatch
while the zmodem or xmodem inner loop has captured it, which
stalls the SFTP queue and blocks Hook.every / Timer.trigger
callbacks for the duration. Add inline_transfer_pump_wren_ —
drains the result queue, sweeps pending timers, dispatches
Hook.every — gated to ~50 ms so per-byte callers are cheap.
Called from zmodem_check_abort, xmodem_check_abort, and
recv_bytes (so a download blocked on conn_recv_upto still pumps).
The two check_abort functions also reshape key handling: drop
the 1-second xp_fast_timer64 gate to 50 ms via xp_timer, and
route every key through wren_host_dispatch_key BEFORE the
ESC/CTRL+C/CTRL+X transfer-cancel paths. Mouse events go to
wren_host_dispatch_mouse, no local handling. Wren-first means a
Wren App layered over the transfer screen (e.g. SftpApp) gets
ESC to dismiss the modal instead of cancelling the transfer; if
no hook claims the key, transfer-cancel still fires.
Co-Authored-By: Claude Opus 4.7 (1M context) <
noreply@anthropic.com>
---
■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net