Skip to content

refactor: make SSH connection async using tokio::net::TcpStream#129

Merged
Cleboost merged 1 commit into
masterfrom
refactor/async-ssh-connection
May 10, 2026
Merged

refactor: make SSH connection async using tokio::net::TcpStream#129
Cleboost merged 1 commit into
masterfrom
refactor/async-ssh-connection

Conversation

@Cleboost
Copy link
Copy Markdown
Owner

This pull request refactors the SSH and SFTP connection logic to use asynchronous (async/await) Rust APIs instead of blocking calls, improving performance and responsiveness, especially in the UI. It also updates related UI and helper functions to use the new async signatures, removing unnecessary spawn_blocking wrappers and simplifying code.

Core async/await migration and API changes:

  • Refactored establish_ssh_session in src/ssh_engine.rs to be fully async, using tokio's async networking and DNS lookup, and moved blocking SSH session setup into spawn_blocking for safety. The function signature now takes an owned Option<String> for passwords instead of a borrowed reference. [1] [2]
  • Updated deploy_pubkey and run_remote_command to be async functions, with their internal SSH session setup and remote command execution performed in spawn_blocking. Their signatures now require owned types and are awaited directly. [1] [2]

UI and usage updates:

  • Updated all UI code in src/ui/docker.rs, src/ui/monitor.rs, and src/ui/ssh_keys.rs to call the new async run_remote_command and deploy_pubkey functions directly, removing redundant spawn_blocking wrappers and adjusting for the new signatures. [1] [2] [3] [4] [5] [6]

SFTP connection improvements:

  • Refactored SFTP session creation in get_or_connect_sftp to use the new async SSH session logic and moved only the SFTP handle creation into spawn_blocking, reducing unnecessary thread usage.

These changes modernize the SSH/SFTP handling, improve performance, and simplify the async/UI integration.

@Cleboost Cleboost merged commit 18a0e9d into master May 10, 2026
1 check passed
@Cleboost Cleboost deleted the refactor/async-ssh-connection branch May 10, 2026 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant