Skip to content

Commit

Permalink
SSH2: backport getTimeout()
Browse files Browse the repository at this point in the history
  • Loading branch information
terrafrost committed Mar 5, 2023
1 parent 9e758c1 commit 34d0086
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions phpseclib/Net/SSH2.php
Original file line number Diff line number Diff line change
Expand Up @@ -2872,6 +2872,16 @@ function _privatekey_login($username, $privatekey)
return $this->_disconnect(NET_SSH2_DISCONNECT_BY_APPLICATION);
}

/**
* Return the currently configured timeout
*
* @return int
*/
function getTimeout()
{
return $this->timeout;
}

/**
* Set Timeout
*
Expand Down
10 changes: 10 additions & 0 deletions tests/Unit/Net/SSH2UnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,16 @@ public function testEnableQuietMode()
$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
*/
Expand Down

0 comments on commit 34d0086

Please sign in to comment.