From bc4e66139bb1fccebf3e98dd24c7615b0300c232 Mon Sep 17 00:00:00 2001 From: olegkap_cp Date: Fri, 18 Jan 2013 17:52:57 +0000 Subject: [PATCH] Improve IsSocketConnected test --- Renci.SshClient/Renci.SshNet/Session.NET.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Renci.SshClient/Renci.SshNet/Session.NET.cs b/Renci.SshClient/Renci.SshNet/Session.NET.cs index 9c440c70..493ad927 100644 --- a/Renci.SshClient/Renci.SshNet/Session.NET.cs +++ b/Renci.SshClient/Renci.SshNet/Session.NET.cs @@ -24,9 +24,8 @@ namespace Renci.SshNet partial void IsSocketConnected(ref bool isConnected) { - //isConnected = (!this._isDisconnecting && this._socket != null && this._socket.Connected && this._isAuthenticated && this._messageListenerCompleted != null) && !(this._socket.Poll(10, SelectMode.SelectRead)); - isConnected = (!this._isDisconnecting && this._socket != null && this._socket.Connected && this._isAuthenticated && this._messageListenerCompleted != null) - && !(this._socket.Poll(1, SelectMode.SelectRead) && this._socket.Available == 0); + isConnected = (!this._isDisconnecting && this._socket != null && this._socket.Connected && this._isAuthenticated && this._messageListenerCompleted != null) + && this._socket.Poll(-1, SelectMode.SelectWrite); } partial void SocketConnect(string host, int port)