• src/sbbs3/js_socket.cpp

    From Rob Swindell (on Windows 11)@1:103/705 to Git commit to main/sbbs/master on Sun Oct 25 13:37:51 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/6a90215fb1d8b41969c854f6
    Modified Files:
    src/sbbs3/js_socket.cpp
    Log Message:
    js: restore the socket's blocking mode after an asynchronous connect

    The connect thread restored the caller's nonblocking setting by passing
    the address of the one-byte bool in its argument block to ioctlsocket()
    as a ulong. The read took in the padding and the port field behind it,
    so the value was nonzero for any nonzero port and the socket was always
    left nonblocking, whatever mode the script had set. A Socket.connect()
    with a callback on a blocking socket therefore returned a nonblocking
    one: send() of more than the kernel would buffer failed with EWOULDBLOCK instead of waiting.

    Copy the flag into a ulong first. Dates from 1928973941 (2021-04-02).

    Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
    --- SBBSecho 3.38-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Rob Swindell (on Windows 11)@1:103/705 to Git commit to main/sbbs/master on Sun Oct 25 16:13:09 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/dd03edda573f914bc975282e
    Modified Files:
    src/sbbs3/js_socket.cpp
    Log Message:
    js: route every FIONBIO ioctl through one helper

    Five sites passed the address of private_t's BOOL nonblocking field to ioctlsocket() through a (ulong*) cast. That is correct only while the
    field stays four bytes wide; the connect-thread copy of the same field
    was converted to bool in 118984e9af (2024-01-19) and broke exactly this
    way, fixed in 6a90215fb1 (2026-10-25).

    Add set_socket_nonblocking(), which copies the flag into a local and
    passes that, so the pointer type is compiler-checked and the field's
    width no longer matters. The local is u_long on Windows and int
    elsewhere, the width each platform's FIONBIO consumer actually reads.
    The ulong locals used until now are 8 bytes on LP64 and only worked on little-endian targets.

    Use the helper for all nine FIONBIO calls in the file, dropping three single-use locals. The TLS session setup also set TCP_NODELAY via a
    ulong; use an int there, as elsewhere since 77d90bedea (2026-05-05).

    Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
    --- SBBSecho 3.38-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)