https://gitlab.synchro.net/main/sbbs/-/commit/93eb019585c9d4389322f2fe
Modified Files:
src/sbbs3/js_socket.cpp
Log Message:
js: don't freeze closing a non-blocking TLS socket
Ending a cryptlib TLS session sends a close alert with a write timeout of
at least 5 seconds, then waits for the peer to acknowledge it. On a non-blocking socket (e.g. an ircd client or server link) that stalled the
whole event loop for 5 seconds per close, and longer when the peer's
receive window was full. Now a non-blocking socket sends the alert only
when it can go at once, behind no partly-written record (which the peer
would see as a corrupt record), and shuts down the read side so cryptlib doesn't wait for the reply. A receive error shuts down both directions
first. The errno is preserved across the session teardown.
do_CryptFlush() kept the unflushed count after a permanent error, so a
socket whose peer had reset kept polling as writable with pending output
(about 96,000 wasted retries in a test). Only a timeout leaves anything
that can still be sent, so the count is now cleared for any other error.
This follows 38c93be5ba (logical-13-face, 2026-11-11).
js_socket_recv() reported a failed pop with the return value (-1) instead
of the cryptlib status, logging "Bad argument, parameter 1" for every
receive error since 472692f792c (bullet-14-flesh, 2018-03-15). A normal
peer disconnect is now logged at debug level as other read errors are.
Tested on GCC/Linux only, against a TLS peer that stalls, resets, sends
a corrupt record, or leaves a full window at close.
Co-Authored-By: Claude Opus 5.5 <
noreply@anthropic.com>
---
þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net