• Stefy Lanza (nextime / spora )'s avatar
    Fix SSH tunneling timing issue with proper data buffering · 31c7eed6
    Stefy Lanza (nextime / spora ) authored
    - Fixed critical timing issue where tunnel_data arrived before SSH client connection
    - Added incoming_buffer to tunnel_t structure for buffering data before SSH client connects
    - Modified handle_tunnel_data() to buffer data when SSH client hasn't connected yet
    - Updated handle_ssh_server_connection() to send buffered data once SSH client connects
    - Fixed socket selection logic to properly handle wssshc buffering scenario
    - Resolved 'Bad file descriptor' errors caused by premature data transmission
    - Implemented proper data flow: buffer → SSH client connection → send buffered data
    - Added comprehensive debug logging for data buffering and transmission
    - Fixed race condition between WebSocket data arrival and SSH client connection
    - Ensured SSH protocol handshake completes properly with buffered data delivery
    - Added proper cleanup for incoming_buffer in tunnel close operations
    - Resolved premature socket disconnection by maintaining proper connection state
    - Fixed SSH client timeout issues by ensuring timely data delivery
    31c7eed6
tunnel.c 37.1 KB