Uh oh!
There was an error while loading. Please reload this page.
remove readonly of AuthenticationConnection in Session - #844
Conversation
wizicer
commented
Aug 4, 2021
SetSshNetConcurrency(100);publicstaticvoidSetSshNetConcurrency(intconcurrency){varfield=typeof(Renci.SshNet.Session).GetField("AuthenticationConnection",BindingFlags.Static|BindingFlags.NonPublic);if(field!=null){field.SetValue(null,newSemaphoreLight(concurrency));}}Utilize this to change it at startup. It works for me flawlessly. |
xantari
commented
Jul 15, 2022
Why are this and other PR's not being checked in. Is the project dead? |
drieseng
commented
Jul 16, 2022
@xantari because I don't have time and because this is clearly a hack. I'm open to alternate proposals but can't promise that I'll immediately find time to discuss them. |
ascott18
commented
Sep 6, 2022
Unfortunately the workaround above does not work on .NET Core 3+ due to dotnet/runtime#11571. Instead, you can do this varsessionSemaphoreField=typeof(Renci.SshNet.Session).GetField("AuthenticationConnection",BindingFlags.Static|BindingFlags.NonPublic);varsemaphoreCountField=typeof(Renci.SshNet.Common.SemaphoreLight).GetField("_currentCount",BindingFlags.Instance|BindingFlags.NonPublic);objectsemaphore=sessionSemaphoreField.GetValue(null);semaphoreCountField.SetValue(semaphore,concurrency);or this, since varsessionSemaphoreField=typeof(Renci.SshNet.Session).GetField("AuthenticationConnection",BindingFlags.Static|BindingFlags.NonPublic);varsemaphore=(Renci.SshNet.Common.SemaphoreLight)sessionSemaphoreField.GetValue(null);// Add a much higher count to the semaphore to prevent pointless blocking of connection attempts.semaphore.Release(100); |
ascott18
commented
Sep 6, 2022
@drieseng I would suggest that the proposal in this comment is the best solution - to remove this semaphore outright and leave throttling as a concern of the calling application. |
Rob-Hague
commented
Feb 6, 2024
The AuthenticationConnection semaphore has been removed in #1304 |
WojciechNagorski
commented
Feb 22, 2024
This issue has been fixed in the 2024.0.0 version. |
remove
readonlyofAuthenticationConnectionin Session to support customize parallel connecting number.Related Issues:
#215
#264
#409
#840