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