SSH2: backport getTimeout()

This commit is contained in:
terrafrost 2023-03-05 01:57:02 -06:00
parent 9e758c180d
commit 34d00869e5
2 changed files with 20 additions and 0 deletions

View File

@ -2872,6 +2872,16 @@ class Net_SSH2
return $this->_disconnect(NET_SSH2_DISCONNECT_BY_APPLICATION);
}
/**
* Return the currently configured timeout
*
* @return int
*/
function getTimeout()
{
return $this->timeout;
}
/**
* Set Timeout
*

View File

@ -106,6 +106,16 @@ class Unit_Net_SSH2UnitTest extends PhpseclibTestCase
$this->assertFalse($ssh->isQuietModeEnabled());
}
public function testGetTimeout()
{
$ssh = new Net_SSH2('localhost');
$this->assertEquals(10, $ssh->getTimeout());
$ssh->setTimeout(0);
$this->assertEquals(0, $ssh->getTimeout());
$ssh->setTimeout(20);
$this->assertEquals(20, $ssh->getTimeout());
}
/**
* @return Net_SSH2
*/