Fix SSH client socket invalidation issue in handle_tunnel_data

- Fixed premature tunnel deactivation when socket fcntl check fails
- Removed aggressive tunnel shutdown on socket validity check failure
- Socket invalidation during tunnel_data processing no longer kills entire tunnel
- SSH client disconnections during data exchange are now handled gracefully
- Prevents race condition between socket validation and data transmission
- Allows tunnel to continue operating even if individual socket checks fail
- Improved error handling for temporary socket state issues
- Fixed issue where SSH client would disconnect immediately after version exchange
- Resolved 'Bad file descriptor' errors during active tunnel operation
- Maintains tunnel stability during SSH protocol handshake phase
- Prevents false positive tunnel closures due to timing-sensitive socket checks
- Added more resilient socket state management for connection stability
- Fixed critical bug causing SSH sessions to terminate prematurely
- Improved robustness of WebSocket-to-SSH data forwarding mechanism
- Resolved intermittent connection failures during protocol negotiation
- Enhanced error recovery for network socket state fluctuations
- Implemented more forgiving socket validation during data transmission
parent 4165730c
...@@ -562,10 +562,8 @@ void handle_tunnel_data(SSL *ssl __attribute__((unused)), const char *request_id ...@@ -562,10 +562,8 @@ void handle_tunnel_data(SSL *ssl __attribute__((unused)), const char *request_id
target_sock, strerror(errno)); target_sock, strerror(errno));
fflush(stdout); fflush(stdout);
} }
// Mark tunnel as inactive since SSH connection is broken // Don't mark tunnel as inactive here - this might be a timing issue
if (active_tunnel) { // Just skip this tunnel_data and continue
active_tunnel->active = 0;
}
pthread_mutex_unlock(&tunnel_mutex); pthread_mutex_unlock(&tunnel_mutex);
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment