• src/sbbs3/main.cpp sbbs.h

    From Rob Swindell (on Windows@VERT to Git commit to main/sbbs/m on Sat Jun 6 02:23:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/9cf170c0246a40f6d502d8b1
    Modified Files:
    src/sbbs3/main.cpp sbbs.h str.cpp
    Log Message:
    Terminal server: fully transmit pre-disconnect message before close (#1157)

    Messages shown to a client immediately before disconnecting (nonodes.txt
    when all nodes are full or node init fails, and badip.msg/badhost.msg for blocked clients) were intermittently not seen by the caller.

    Root cause: these paths printed the file then called flush_output(), which waits on outbuf.empty_event. That event fires when output_thread moves the ring-buffer contents into its *linear* buffer (RingBufRead), not when those bytes are actually sent over the socket. flush_output() therefore returned
    in the gap between ring->linear hand-off and the sendsocket(), the caller closed the socket, and output_thread's send then failed on the closed FD ("!ERROR ... sending on socket"). The result was a thread-scheduling race, matching the reporter's intermittent, protocol-independent symptom.

    Add sbbs_t::WaitForOutbufDrained(timeout): wait for the ring buffer to
    empty AND for output_thread's linear buffer to be transmitted, tracked via
    a new output_thread_busy atomic (set before the ring->linear read so the empty_event hand-off can't be mistaken for "everything sent", cleared once
    the linear buffer is fully sent). Use it in place of flush_output() at the
    two nonodes.txt disconnect sites (main.cpp) and in trashcan_msg() (str.cpp).

    flush_output() is retained for outcom()'s transmit-backpressure retry loop, where "wait for ring-buffer space" (with its online short-circuit) is the correct semantics.

    The nonodes drop-before-close pattern is from ff1aae498 (same-3-jazz); trashcan_msg()'s flush_output(500) is from 424dfe107 (cold-36-task); the underlying empty_event-means-ring-drained-not-sent gap is inherent to the two-stage output_thread design.

    Reported by xbit with detailed cross-client testing.

    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net
  • From Rob Swindell (on Debian L@VERT to Git commit to main/sbbs/m on Thu Sep 24 21:22:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/5b9f0f0bd4434aabd0872e33
    Modified Files:
    src/sbbs3/main.cpp sbbs.h termaudio.c termaudio.h termaudio_cache.cpp termaudio_test.c
    Log Message:
    termaudio: trust a cached sound only if its contents match its name

    Message text can write into a reader's SyncTERM file cache: putmsg()
    strips the C;L query but passes the C;S store command through. A post
    could therefore store its own file under the content-addressed name of
    one of the system's sounds, and later sessions, seeing that name in the
    C;L listing, would play it instead of uploading the real one. An entry
    is now accepted only when the MD5 the client reports for the file
    matches the hash in its name, so a planted file is treated as absent and overwritten by the next upload. A file planted during the current
    session can still be played until that session ends.

    Also:

    Keys typed while waiting for the C;L reply were discarded, and a reply
    too large for the buffer was abandoned partway, leaving its remainder to
    be read as keystrokes. The reply is now scanned by a separate, unit-
    tested function: bytes before the reply are handed back to the input
    stream in order, and an oversized reply is read to its end and used up
    to what fit. Lines the truncation cuts short fail the MD5 check.

    Only letters and digits are taken from a file's extension when building
    its cache name, which is sent inside an APC. A ';' there split the
    command's fields, and an ESC could end the string.

    The cache name of each file is remembered for the session, keyed on
    size and modification time, so replaying a large preloaded file no
    longer reads and hashes all of it again just to find it already cached.

    Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net