Quellcode durchsuchen

Revert to previous code as its a little more clear.

drieseng vor 9 Jahren
Ursprung
Commit
35c9ecfd56
1 geänderte Dateien mit 2 neuen und 5 gelöschten Zeilen
  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));