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 GitHub
parent 5a02ce27ac
commit 3b03bad409
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2969,7 +2969,7 @@ class SSH2
*/
public function isConnected(): bool
{
return (bool) ($this->bitmap & self::MASK_CONNECTED);
return (bool) ($this->bitmap & self::MASK_CONNECTED) && is_resource($this->fsock) && !feof($this->fsock);
}
/**