-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Labels
pdsh-compatpdsh compatibility mode featurespdsh compatibility mode featurespriority:mediumMedium priority issueMedium priority issuestatus:doneCompletedCompletedtype:enhancementNew feature or requestNew feature or request
Description
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
- Add
--connect-timeoutoption toClistruct insrc/cli.rs - Pass connection timeout to SSH client configuration
- Modify
src/ssh/client.rsto accept configurable timeout - Update executor to use CLI-provided timeout
- Add unit tests for timeout behavior
- Update help text and examples
Acceptance Criteria
-
--connect-timeout Nsets SSH connection timeout to N seconds - Default remains 30 seconds for backward compatibility
- Connection timeout is independent of
--timeout(command timeout) - Timeout of 0 should be disallowed or mean "no timeout" (needs decision)
- Clear error message when connection times out
- Works correctly with parallel connections
Technical Considerations
- Currently
tokio::time::timeoutwraps 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--ttyin bssh) - In pdsh compatibility mode,
-twill map to--connect-timeout
Related
Metadata
Metadata
Assignees
Labels
pdsh-compatpdsh compatibility mode featurespdsh compatibility mode featurespriority:mediumMedium priority issueMedium priority issuestatus:doneCompletedCompletedtype:enhancementNew feature or requestNew feature or request