소스 검색

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);
         }