Pārlūkot izejas kodu

Revert to previous code as its a little more clear.

drieseng 9 gadi atpakaļ
vecāks
revīzija
35c9ecfd56
1 mainītis faili ar 2 papildinājumiem un 5 dzēšanām
  1. 2 5
      src/Renci.SshNet/Channels/ChannelSession.cs

+ 2 - 5
src/Renci.SshNet/Channels/ChannelSession.cs

@@ -64,11 +64,8 @@ namespace Renci.SshNet.Channels
         /// </summary>
         public virtual void Open()
         {
-            if (IsOpen)
-                return;
-
             //  Try to open channel several times
-            do
+            while (!IsOpen && _failedOpenAttempts < ConnectionInfo.RetryAttempts)
             {
                 SendChannelOpenMessage();
                 try
@@ -81,7 +78,7 @@ namespace Renci.SshNet.Channels
                     ReleaseSemaphore();
                     throw;
                 }
-            } while (!IsOpen && _failedOpenAttempts < ConnectionInfo.RetryAttempts);
+            }
 
             if (!IsOpen)
                 throw new SshException(string.Format(CultureInfo.CurrentCulture, "Failed to open a channel after {0} attempts.", _failedOpenAttempts));