• src/syncterm/sftp_session.hsrc/syncterm/ssh.c

    From Deucе@1:103/705 to Git commit to main/sbbs/master on Fri Apr 24 14:19:27 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/f346fc7286f3781269a74cb3
    Added Files:
    src/syncterm/sftp_session.h
    Modified Files:
    src/syncterm/ssh.c
    Log Message:
    SyncTERM: persistent SFTP subsystem channel per SSH session

    Open the SFTP subsystem channel once, right after the shell channel
    opens, and keep it alive for the lifetime of the SSH session. The
    channel's sftpc_state_t, atomics for "SFTP available" and "shell
    alive", and the recv thread are all session-scoped; browser / transfer
    queue code (later phases) pulls the shared state from sftp_session.h.

    add_public_key() stops opening its own channel and just uses the
    shared sftp_state. ssh_close() tears down in the right order:
    sftpc_finish waits for any in-flight ops to drain, the recv thread
    stops polling sftp_chan, then the channel closes, then sftpc_end
    releases the state.

    If the server doesn't support the SFTP subsystem, sftp_available
    stays false and the shell continues normally — this is not an error.

    Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)