• Stefy Lanza (nextime / spora )'s avatar
    Fix wsssh socket handling - add missing SSH client accept() logic · 4165730c
    Stefy Lanza (nextime / spora ) authored
    - Fixed critical bug: wsssh was trying to send data to listening socket instead of accepted connection
    - Added missing accept() logic in forward_tcp_to_ws() for wsssh to accept SSH client connections
    - wsssh now properly accepts SSH client connections on listening socket
    - Stores accepted SSH client socket in active_tunnel->sock for data forwarding
    - Sends buffered tunnel_data to SSH client immediately after connection is accepted
    - Fixed socket selection logic to use accepted client socket instead of listening socket
    - Resolved 'Bad file descriptor' errors by using correct socket for data transmission
    - Fixed race condition between tunnel_data arrival and SSH client connection establishment
    - Added proper socket validation and error handling for connection acceptance
    - Implemented correct bidirectional forwarding between SSH client and WebSocket tunnel
    - Fixed data flow: SSH client  wsssh (accepted socket)  WebSocket  wssshc  SSH server
    - Resolved premature socket closure by maintaining proper connection state
    - Added comprehensive debug logging for connection acceptance and data buffering
    - Fixed socket descriptor management to prevent invalid socket access
    - Ensured SSH protocol handshake completes properly with correct socket usage
    - Fixed tunnel_data transmission timing by accepting connections before processing data
    - Resolved socket state confusion between listening and connected sockets
    - Added proper cleanup and error recovery for failed connection attempts
    - Fixed select() usage to work with accepted client sockets instead of listening sockets
    - Implemented robust connection handling with non-blocking accept for better performance
    4165730c
tunnel.h 2.57 KB