https://gitlab.synchro.net/main/sbbs/-/commit/c53a9bd2a9f77019061038c0
Modified Files:
src/ssh/TODO.md deucessh-conn.h ssh-arch.c ssh-arch.h ssh-chan.c ssh-chan.h ssh-conn.c ssh-internal.h src/ssh/test/CMakeLists.txt test_arch.c test_chan.c test_conn.c
Log Message:
Fix channel close race, remove 14 dead functions (items 62, 79, 89)
Item 62/79: dssh_session_close() and dssh_channel_close() freed the
channel while the demux thread held buf_mtx, causing use-after-free.
Added atomic_bool closing to channel struct; close functions set it
before unregistering, then acquire/release buf_mtx to synchronize. demux_dispatch() checks closing after each unlock-relock window
(window-change callback, send CHANNEL_FAILURE) and bails out.
Added test_close_during_wc_cb regression test (8 CTest variants).
Item 89: Removed 14 DSSH_PRIVATE functions with no library callers
(test-only): parse/serialize for byte, boolean, uint64, string, mpint,
namelist (ssh-arch.c) and msgqueue_peek_size (ssh-chan.c). Cleaned up declarations in ssh-arch.h and ssh-chan.h, removed dead test cases.
Co-Authored-By: Claude Opus 4.6 (1M context) <
noreply@anthropic.com>
---
■ Synchronet ■ Vertrauen ■ Home of Synchronet ■ [vert/cvs/bbs].synchro.net