sshnet / SSH.NET

SSH.NET is a Secure Shell (SSH) library for .NET, optimized for parallelism.
http://sshnet.github.io/SSH.NET/
MIT License
3.96k stars 931 forks source link

Fix #1275. Hung Dispose() caused by infinite socket timeout #1280

Closed jkillingsworth closed 9 months ago

jkillingsworth commented 9 months ago

This is a fix for the issue described in #1275. This fix is based on a suggestion by @Rob-Hague in https://github.com/sshnet/SSH.NET/issues/1275#issuecomment-1864933734.

Note that I have suppressed the S2222 warning. I believe this to be a false positive. I don't see any execution paths where the lock does not get released.

WojciechNagorski commented 9 months ago

@Rob-Hague Can you make a review? It's your idea.

WojciechNagorski commented 9 months ago

The 2023.0.1 version has been released to Nuget: https://www.nuget.org/packages/SSH.NET/2023.0.1

jkillingsworth commented 9 months ago

The 2023.0.1 version has been released to Nuget: https://www.nuget.org/packages/SSH.NET/2023.0.1

Thank you @WojciechNagorski!