BBS:      TELESC.NET.BR
Assunto:  src/ssh/README.md deucessh-conn.h ssh-conn.c src/ssh/test/test_conn.c
De:       Deuc¨
Data:     Tue, 5 May 2026 08:28:03 -0700
-----------------------------------------------------------
https://gitlab.synchro.net/main/sbbs/-/commit/cd48edf479cad089934c941c
Modified Files:
	src/ssh/README.md deucessh-conn.h ssh-conn.c src/ssh/test/test_conn.c
Log Message:
DeuceSSH: dssh_chan_poll surfaces terminate as POLLHUP

When a session is terminated mid-poll, dssh_chan_poll used to return
0 -- indistinguishable from a timeout -- so a caller in a finite-
timeout poll loop couldn't tell that the session was gone and would
keep polling forever.

Mirror POSIX POLLHUP: when sess->terminate is set, surface every
requested data flag (READ, READEXT, WRITE) as ready regardless of
buffer state, just as close_received already does for READ/READEXT.
The caller's next dssh_chan_read returns 0 (EOF) once any buffered
data has been drained, and dssh_chan_write returns a negative error,
so a poll loop exits naturally through the subsequent I/O call.
DSSH_POLL_EVENT is intentionally not surfaced -- no real event is
queued, callers should rely on the data flags or the terminate
callback to detect termination.

Documented in deucessh-conn.h on the dssh_chan_poll prototype and in
README.md "Poll events".

Two new tests in test_conn.c:
  - poll/terminate_surfaces_data: terminate before poll, expect
    READ|READEXT|WRITE returned immediately even with timeout=5000;
    follow-up chan_read returns 0
  - poll/terminate_no_event_bit: poll(EVENT|READ) after terminate
    surfaces only READ, never EVENT

OpenSSL: 3410/3410 pass.  Botan: 3411/3411 pass.

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

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