Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ConnectAsync not respecting the connection timeout #1502

Merged
merged 1 commit into from
Sep 22, 2024

Conversation

mus65
Copy link
Contributor

@mus65 mus65 commented Sep 22, 2024

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 .

Copy link
Collaborator

@Rob-Hague Rob-Hague left a comment

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
1 check failed
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