BBS:      TELESC.NET.BR
Assunto:  src/ssh/TODO.md ssh-conn.c
De:       Deuc¨
Data:     Mon, 30 Mar 2026 14:17:14 -0700
-----------------------------------------------------------
https://gitlab.synchro.net/main/sbbs/-/commit/a6fc65e8269ab5a07c35f3a9
Modified Files:
	src/ssh/TODO.md ssh-conn.c
Log Message:
Fix send_channel_request_wait race: CLOSE clobbering successful response

When the server accepted a channel request (CHANNEL_SUCCESS) and then
immediately closed the channel (CHANNEL_CLOSE), the client's demux
thread could process both messages before the client thread woke up.
The post-loop check `if (sess->terminate || ch->close_received)` then
returned DSSH_ERROR_TERMINATED even though request_responded was true,
discarding the successful response and causing dssh_chan_open to return
NULL.

Fix: capture `responded` under buf_mtx; only return TERMINATED when
the loop exited without getting a response.  If the server explicitly
answered, honor that answer regardless of close_received.

Observed as test_self_exec_exit_code failing under -j16, predominantly
with RSA variants where keygen CPU contention widens the scheduling
window between the two demux dispatches.

Co-Authored-By: Claude Opus 4.6 (1M context) 
n
---
  mSynchronetn  hgVertrauen n hHome of Synchronet n gh[vert/cvs/bbs].synchro.net

-----------------------------------------------------------
[Voltar]