Repository navigation
feat(rsync_io): SshConnection connect_with_config (timeout + keepalive) (#1795) - #4266
Merged
Merged
Conversation
…e) (#1795) Introduce a structured connection primitive that wraps the existing `SshCommand` builder behind explicit `SshConnectConfig` and `KeepAliveConfig` structs. This is the first concrete step in the SSH transport chain (#1795 -> #1796 -> #1797 -> #1805 -> #1806) and lets upstream call sites compose connect, auth, and session-setup steps from a single config value instead of a long sequence of builder setters. The new `SshConnection::connect_with_config(remote, &config)` entry point stays synchronous and reuses the existing watchdog + stderr-drain plumbing. Defaults mirror the historical `SshCommand::new` behaviour (30 s connect timeout, 20 s keepalive interval, 3 allowed failures); a `None` field disables the corresponding `-o ConnectTimeout` or `-o ServerAlive*` injection. The async variant is reserved for task #1801 and intentionally not introduced here, so no new runtime dependencies land in this PR. Unit coverage exercises the config defaults, the builder-setter round trip, the rendered argv (timeout, keepalive, remote command ordering), keepalive disabled / custom-value cases, sub-second rounding, and user/host splitting. A unix-gated, env-guarded smoke test (`OC_RSYNC_SSH_NET=1`) confirms an unreachable host surfaces an io::Error within ~2x the configured timeout.
Merged
1 of 5 tasks
oferchen
added a commit
that referenced
this pull request
May 18, 2026
…e) (#1795) (#4266) Introduce a structured connection primitive that wraps the existing `SshCommand` builder behind explicit `SshConnectConfig` and `KeepAliveConfig` structs. This is the first concrete step in the SSH transport chain (#1795 -> #1796 -> #1797 -> #1805 -> #1806) and lets upstream call sites compose connect, auth, and session-setup steps from a single config value instead of a long sequence of builder setters. The new `SshConnection::connect_with_config(remote, &config)` entry point stays synchronous and reuses the existing watchdog + stderr-drain plumbing. Defaults mirror the historical `SshCommand::new` behaviour (30 s connect timeout, 20 s keepalive interval, 3 allowed failures); a `None` field disables the corresponding `-o ConnectTimeout` or `-o ServerAlive*` injection. The async variant is reserved for task #1801 and intentionally not introduced here, so no new runtime dependencies land in this PR. Unit coverage exercises the config defaults, the builder-setter round trip, the rendered argv (timeout, keepalive, remote command ordering), keepalive disabled / custom-value cases, sub-second rounding, and user/host splitting. A unix-gated, env-guarded smoke test (`OC_RSYNC_SSH_NET=1`) confirms an unreachable host surfaces an io::Error within ~2x the configured timeout.
oferchen
added a commit
that referenced
this pull request
May 18, 2026
…e) (#1795) (#4266) Introduce a structured connection primitive that wraps the existing `SshCommand` builder behind explicit `SshConnectConfig` and `KeepAliveConfig` structs. This is the first concrete step in the SSH transport chain (#1795 -> #1796 -> #1797 -> #1805 -> #1806) and lets upstream call sites compose connect, auth, and session-setup steps from a single config value instead of a long sequence of builder setters. The new `SshConnection::connect_with_config(remote, &config)` entry point stays synchronous and reuses the existing watchdog + stderr-drain plumbing. Defaults mirror the historical `SshCommand::new` behaviour (30 s connect timeout, 20 s keepalive interval, 3 allowed failures); a `None` field disables the corresponding `-o ConnectTimeout` or `-o ServerAlive*` injection. The async variant is reserved for task #1801 and intentionally not introduced here, so no new runtime dependencies land in this PR. Unit coverage exercises the config defaults, the builder-setter round trip, the rendered argv (timeout, keepalive, remote command ordering), keepalive disabled / custom-value cases, sub-second rounding, and user/host splitting. A unix-gated, env-guarded smoke test (`OC_RSYNC_SSH_NET=1`) confirms an unreachable host surfaces an io::Error within ~2x the configured timeout.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…e) (#1795) (#4266) Introduce a structured connection primitive that wraps the existing `SshCommand` builder behind explicit `SshConnectConfig` and `KeepAliveConfig` structs. This is the first concrete step in the SSH transport chain (#1795 -> #1796 -> #1797 -> #1805 -> #1806) and lets upstream call sites compose connect, auth, and session-setup steps from a single config value instead of a long sequence of builder setters. The new `SshConnection::connect_with_config(remote, &config)` entry point stays synchronous and reuses the existing watchdog + stderr-drain plumbing. Defaults mirror the historical `SshCommand::new` behaviour (30 s connect timeout, 20 s keepalive interval, 3 allowed failures); a `None` field disables the corresponding `-o ConnectTimeout` or `-o ServerAlive*` injection. The async variant is reserved for task #1801 and intentionally not introduced here, so no new runtime dependencies land in this PR. Unit coverage exercises the config defaults, the builder-setter round trip, the rendered argv (timeout, keepalive, remote command ordering), keepalive disabled / custom-value cases, sub-second rounding, and user/host splitting. A unix-gated, env-guarded smoke test (`OC_RSYNC_SSH_NET=1`) confirms an unreachable host surfaces an io::Error within ~2x the configured timeout.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SshConnectConfigandKeepAliveConfigplus aSshConnection::connect_with_config(remote, &config)entry point in a newcrates/rsync_io/src/ssh/connect.rsmodule. This is the first concrete step in the SSH transport chain (Add canonical rsync entrypoints #1795 -> Fix unused io import under Windows for preallocation #1796 -> Document apple filesystem helpers #1797 -> Enforce unique cross-compile metadata entries #1805 -> Handle forced missing cargo tools in packaging tests #1806) - it lets higher layers compose connect / auth / session setup from a single tagged config value instead of a long sequence ofSshCommandsetters.std::process::Command); the async variant (AsyncSshTransport::connect) is reserved for task Align remote fallback test with availability diagnostic #1801 and explicitly out of scope. No new runtime dependencies are added in this PR.SshCommand::newbehaviour (30 s connect timeout, 20 s keepalive interval, 3 allowed failures). Setting either field toNonedisables the corresponding-o ConnectTimeout/-o ServerAlive*injection.Public surface
Existing
SshCommand/SshConnectionAPIs continue to work unchanged; the new constructor is purely additive.Test plan
cargo fmt --allcargo check -p rsync_io --all-targetscargo clippy -p rsync_io --all-targets --no-deps -- -D warningsconnect_with_short_timeout_returns_io_errorsmoke test withOC_RSYNC_SSH_NET=1on a host with outbound SSH allowed.