• src/sbbs3/js_internal.cpp 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/2c1ce331e85657a9c3765f80
    Modified Files:
    src/sbbs3/js_internal.cpp js_socket.cpp
    Log Message:
    js: release asynchronous connect resources on setup failure and clear

    Socket.connect() with a callback linked and GC-rooted the connect event
    before allocating the thread's argument block and copying the hostname.
    When either allocation failed, the function closed the socket pair and
    returned an error, but left the event in the list pointing at the closed descriptors, so the next event-loop pass selected on them. Allocate the
    thread arguments first; the event is only linked once nothing after it
    can fail.

    Clearing all pending events freed a pending connect event without
    closing its socket pair's read end, leaking a descriptor each time a
    script ended with an asynchronous connect in flight.

    Both date 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)