Преглед изворни кода

Throw an exception if connection could not be established

olegkap_cp пре 13 година
родитељ
комит
67c90147df
1 измењених фајлова са 4 додато и 1 уклоњено
  1. 4 1
      Renci.SshClient/Renci.SshNet/Session.NET.cs

+ 4 - 1
Renci.SshClient/Renci.SshNet/Session.NET.cs

@@ -42,7 +42,10 @@ namespace Renci.SshNet
             //  Connect socket with specified timeout
             var connectResult = this._socket.BeginConnect(ep, null, null);
 
-            connectResult.AsyncWaitHandle.WaitOne(this.ConnectionInfo.Timeout, false);
+            if (!connectResult.AsyncWaitHandle.WaitOne(this.ConnectionInfo.Timeout, false))
+            {
+                throw new SshOperationTimeoutException("Connection Could Not Be Established");
+            }
 
             this._socket.EndConnect(connectResult);
         }