Skip to content

fix ConnectAsync not respecting the connection timeout#1502

Merged
Rob-Hague merged 1 commit into
sshnet:developfrom
mus65:connectasynctimeout
Sep 22, 2024
Merged

fix ConnectAsync not respecting the connection timeout#1502
Rob-Hague merged 1 commit into
sshnet:developfrom
mus65:connectasynctimeout

Conversation

@mus65

@mus65 mus65 commented Sep 22, 2024

Copy link
Copy Markdown
Contributor

BaseClient.ConnectAsync doesn't respect the connection timeout because the async methods in the lower layers all just check the cancellationToken passed by the caller.

Fix this by creating a linked cancellation token in ConnectAsync and passing this one through the lower layers.

If the timeout is hit, it throws SshOperationTimeoutException (like Connect() does). If the user provided token is cancelled, OperationCanceledException is thrown (as before).

Fixes #1411 .

@Rob-Hague Rob-Hague left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍

@Rob-Hague Rob-Hague merged commit 28e6742 into sshnet:develop Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SftpClient.ConnectAsync hangs

2 participants