Skip to content

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