• src/sbbs3/ftpsrvr.cpp

    From Rob Swindell (on Debian Linux)@1:103/705 to Git commit to main/sbbs/master on Monday, October 26, 2026 00:09:03
    https://gitlab.synchro.net/main/sbbs/-/commit/b73ac2b9c7affe55b51c47c5
    Modified Files:
    src/sbbs3/ftpsrvr.cpp
    Log Message:
    ftpsrvr: pack QWK and import REP packets in-process via qwkjob

    A QWK download (RETR <qwk-id>.qwk, and SIZE/MDTM of that name) used to
    create a data/pack<user#>.<host>.now semaphore and poll for up to
    QwkTimeout seconds while the Terminal Server's event thread built the
    packet. An FTP-only instance, or one whose event thread was busy or
    disabled, timed out with "451 Time-out waiting for packet creation."
    The control thread now calls qwkjob_pack() itself:

    - no new messages: 550 (unchanged); logged-in at a terminal node: 550
    Logged-in elsewhere
    - the user's pack lock is held (another session, script or host is
    packing or importing for the same user): immediate 451 "Packet
    creation already in progress" (unchanged text)
    - the per-process job cap is reached: retry once a second for up to
    QwkTimeout, then the unchanged time-out 451, so QwkTimeout keeps its
    meaning as the longest a RETR waits
    - if the client disconnects, the pack still completes and the packet
    stays in data/file/ for the next RETR

    A REP upload (STOR <qwk-id>.rep) is now received into <temp>/rep/<user#>.<socket>.rep and imported by the receive thread
    after the file is closed and before the 226, instead of being left in data/file/ for the event thread. A packet that fails to import is kept
    as data/file/<user#>.rep.<hex-time>.bad (an empty one is removed) and
    the client still gets 226, since uploading it again would not help.
    When the user's lock is held or the job cap is reached, the REP is
    queued for the event thread's sweep as data/file/<user#>.rep, or <user#>.<hex-time>.rep if a REP is already pending; temp and data can be
    on different volumes, so a failed rename falls back to a copy under a
    name the sweep ignores, then a rename. The control connection's
    inactivity clock is reset after the import.

    QWK job log lines are prefixed "ftp" and go through the server's own
    log function (so LOG_ERR lines reach error.log and MQTT).

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