fix: SSH keepalive + auto-reconnect for SFTP and terminal
- Add transport.set_keepalive(30) to all SSH connections - Add SFTPSession.reconnect() method - Auto-reconnect in _refresh_remote with retry on failure - Auto-reconnect before upload/download operations - Guard all remote navigation methods with connection checks - ShellSession.connected wrapped in try/except - Terminal: reset reconnect counter on send failure, increase max to 5 - Terminal: trigger reconnect on send to dead session Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -17,7 +17,7 @@ class TerminalTab(ctk.CTkFrame):
|
||||
self._current_alias: str | None = None
|
||||
self._session: ShellSession | None = None
|
||||
self._reconnect_count = 0
|
||||
self._max_reconnect = 3
|
||||
self._max_reconnect = 5
|
||||
self._intentional_disconnect = False
|
||||
|
||||
# Import here to avoid circular issues
|
||||
@@ -142,6 +142,10 @@ class TerminalTab(ctk.CTkFrame):
|
||||
session = self._session # local ref for thread safety
|
||||
if session and session.connected:
|
||||
session.send(data)
|
||||
elif self._current_alias and not self._intentional_disconnect:
|
||||
# Session dead — trigger reconnect
|
||||
self._reconnect_count = 0
|
||||
self._on_disconnected()
|
||||
|
||||
def _on_resize(self, cols: int, rows: int):
|
||||
session = self._session # local ref for thread safety
|
||||
|
||||
Reference in New Issue
Block a user