mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-11 01:36:39 +00:00
Fix IsConnected property behaviour
Fix SocketReadLine if 0 bytes received
This commit is contained in:
@@ -59,7 +59,11 @@ namespace Renci.SshNet
|
||||
var data = new byte[1];
|
||||
do
|
||||
{
|
||||
this._socket.Receive(data);
|
||||
var received = this._socket.Receive(data);
|
||||
|
||||
// If zero bytes received then exit
|
||||
if (received == 0)
|
||||
break;
|
||||
|
||||
buffer.Add(data[0]);
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace Renci.SshNet
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._socket != null && this._socket.Connected && this._isAuthenticated && this._messageListenerCompleted != null;
|
||||
return (!this._isDisconnecting && this._socket != null && this._socket.Connected && this._isAuthenticated && this._messageListenerCompleted != null) && !(this._socket.Poll(10, SelectMode.SelectRead));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1844,7 +1844,7 @@ namespace Renci.SshNet
|
||||
var encoding = new Renci.SshNet.Common.ASCIIEncoding();
|
||||
|
||||
this.SocketWrite(encoding.GetBytes(string.Format("CONNECT {0}:{1} HTTP/1.0\r\n", this.ConnectionInfo.Host, this.ConnectionInfo.Port)));
|
||||
|
||||
|
||||
// Sent proxy authorization is specified
|
||||
if (!string.IsNullOrEmpty(this.ConnectionInfo.ProxyUsername))
|
||||
{
|
||||
@@ -2047,4 +2047,4 @@ namespace Renci.SshNet
|
||||
public Type Type { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user