Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@Rob-Hague
Copy link
Collaborator

@Rob-Hague Rob-Hague commented Feb 3, 2024

  • Change _connectAndLazySemaphoreInitLock to a SemaphoreSlim and use it in ConnectAsync.
  • Rename it to _connectLock and only use it for connecting. Replace its other usages (on SessionSemaphore and NextChannelNumber) with Interlocked operations.
  • Remove AuthenticationConnection semaphore. This static member placed a process-wide limit on the number of connections an application can make. I agree with the argument in Effective concurrent SshClient connections bumps into a limit #409 (comment) (and in several other issues/PRs) that this should not be something that the library attempts to control.

The last change broke a few tests which do things like making 100 connections (exceeding OpenSSH MaxStartups value). I was tempted to delete these tests as I don't think they have much value, but instead I just limited their concurrency.

Best viewed with "Hide whitespace"

- Change _connectAndLazySemaphoreInitLock to a SemaphoreSlim and use it in
  ConnectAsync.
- Rename it to _connectLock and only use it for connecting. Replace its
  other usages (on SessionSemaphore and NextChannelNumber) with Interlocked
  operations.
- Remove AuthenticationConnection semaphore. This static member placed a
  process-wide limit on the number of connections an application can make.
  I agree with the argument in
  sshnet#409 (comment)
  (and in several other issues/PRs) that this should not be something
  that the library attempts to control.

The last change broke a few tests which do things like making 100 connections.
I was tempted to delete these tests as I don't think they have much value, but
instead I just limited their concurrency.
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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.