Summary
Add a new --connect-timeout option to bssh that sets the SSH connection timeout separately from the command execution timeout. This is a prerequisite for pdsh compatibility mode.
Parent Issue
Part of #91 (pdsh compatibility mode) - Phase 1: New Options for Feature Parity
Background
pdsh distinguishes between two types of timeouts:
-t seconds: Connection timeout (how long to wait for SSH connection, default 10s)
-u seconds: Command timeout (how long to allow command to run)
Currently bssh has --timeout which controls command execution timeout, but lacks a separate connection timeout option. This distinction is important for:
- Slow networks where connection takes longer
- Fast operations where command should timeout quickly but connection can take time
- Fine-grained control over failure modes
Current Behavior
// In src/ssh/client.rs
const DEFAULT_CONNECT_TIMEOUT: Duration = Duration::from_secs(30);
The connection timeout is currently hardcoded at 30 seconds.
Proposed Implementation
CLI Interface
# Default: 30s connection timeout
bssh -H "node1,node2" "uptime"
# Custom connection timeout
bssh -H "node1,node2" --connect-timeout 10 "uptime"
# Combined with command timeout
bssh -H "node1,node2" --connect-timeout 5 --timeout 60 "long-command"
Option Definition
#[arg(
long = "connect-timeout",
default_value = "30",
value_name = "SECONDS",
help = "SSH connection timeout in seconds [default: 30]"
)]
pub connect_timeout: u64,
Implementation Tasks
Acceptance Criteria
Technical Considerations
- Currently
tokio::time::timeout wraps the connect call
- May need to propagate timeout value through connection chain
- Consider if this should also apply to authentication timeout
Notes
- Using
--connect-timeout (long form only) to avoid conflict with -t (which is --tty in bssh)
- In pdsh compatibility mode,
-t will map to --connect-timeout
Related
Summary
Add a new
--connect-timeoutoption to bssh that sets the SSH connection timeout separately from the command execution timeout. This is a prerequisite for pdsh compatibility mode.Parent Issue
Part of #91 (pdsh compatibility mode) - Phase 1: New Options for Feature Parity
Background
pdsh distinguishes between two types of timeouts:
-t seconds: Connection timeout (how long to wait for SSH connection, default 10s)-u seconds: Command timeout (how long to allow command to run)Currently bssh has
--timeoutwhich controls command execution timeout, but lacks a separate connection timeout option. This distinction is important for:Current Behavior
The connection timeout is currently hardcoded at 30 seconds.
Proposed Implementation
CLI Interface
Option Definition
Implementation Tasks
--connect-timeoutoption toClistruct insrc/cli.rssrc/ssh/client.rsto accept configurable timeoutAcceptance Criteria
--connect-timeout Nsets SSH connection timeout to N seconds--timeout(command timeout)Technical Considerations
tokio::time::timeoutwraps the connect callNotes
--connect-timeout(long form only) to avoid conflict with-t(which is--ttyin bssh)-twill map to--connect-timeoutRelated