Add EOF test to SSH2::isConnected

This adds an additional test to SSH2::isConnected to make it more intuitive. Aside from testing against the internal state, it will also assert that there is an internal socket and that that socket has not reached EOF.
This commit is contained in:
Kevin Reniers 2023-07-04 15:01:48 +02:00 committed by terrafrost
parent de09e8e817
commit 38a2a84da1

View File

@ -3442,7 +3442,7 @@ class Net_SSH2
*/
function isConnected()
{
return (bool) ($this->bitmap & NET_SSH2_MASK_CONNECTED);
return ($this->bitmap & NET_SSH2_MASK_CONNECTED) && is_resource($this->fsock) && !feof($this->fsock);
}
/**