put: bound the SSH connect and session operations with timeouts

TcpStream::connect and the blocking libssh2 session had no timeouts: a
black-holed host hung pkh put forever, mid-resolution, mid-handshake or
mid-upload. Connect attempts now get a 15 s timeout per resolved
address, the session gets a 30 s API timeout for the handshake/auth
phase and a 300 s per-call timeout for SFTP operations (per low-level
libssh2 call, not per transfer — documented); failures name the
operation and host.
This commit is contained in:
2026-09-18 02:03:20 +02:00
parent 3feca504fc
commit b20acf3199
2 changed files with 195 additions and 13 deletions
+1 -1
View File
@@ -159,7 +159,7 @@ pub async fn put(
bar.set_prefix(format!("Uploading {name}..."));
let remote = format!("{}/{}", target.incoming.trim_end_matches('/'), name);
let result = ssh::upload_file(&sftp, path, &remote, &bar);
let result = ssh::upload_file(&sftp, path, &remote, &host, &bar);
bar.finish_and_clear();
result?;
}