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:
+1
-1
@@ -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?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user