Skip to content

Renci optimize session issue #861 #860

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

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions src/Renci.SshNet/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -565,19 +565,15 @@ public void Connect()
if (IsConnected)
return;

try
lock (this)
{
AuthenticationConnection.Wait();

// If connected don't connect again
if (IsConnected)
return;

lock (this)
try
{
// If connected don't connect again
if (IsConnected)
return;

AuthenticationConnection.Wait();
// Reset connection specific information
Reset();

Expand Down Expand Up @@ -662,10 +658,10 @@ public void Connect()
RegisterMessage("SSH_MSG_CHANNEL_EOF");
RegisterMessage("SSH_MSG_CHANNEL_CLOSE");
}
}
finally
{
AuthenticationConnection.Release();
finally
{
AuthenticationConnection.Release();
}
}
}

Expand Down