浏览代码

Revert to previous code as its a little more clear.

drieseng 9 年之前
父节点
当前提交
35c9ecfd56
共有 1 个文件被更改,包括 2 次插入5 次删除
  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));