mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-02-06 13:58:33 +00:00
Merge branch '3.0'
This commit is contained in:
commit
cb5331cfc9
@ -675,13 +675,6 @@ class SSH2
|
|||||||
*/
|
*/
|
||||||
private int|null $keepAlive = null;
|
private int|null $keepAlive = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* Timestamp for the last sent keep alive message
|
|
||||||
*
|
|
||||||
* @see self::send_keep_alive()
|
|
||||||
*/
|
|
||||||
private float|null $keep_alive_sent = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Real-time log file pointer
|
* Real-time log file pointer
|
||||||
*
|
*
|
||||||
@ -3153,7 +3146,6 @@ class SSH2
|
|||||||
$this->hmac_check = $this->hmac_create = false;
|
$this->hmac_check = $this->hmac_create = false;
|
||||||
$this->hmac_size = false;
|
$this->hmac_size = false;
|
||||||
$this->session_id = false;
|
$this->session_id = false;
|
||||||
$this->keep_alive_sent = null;
|
|
||||||
$this->get_seq_no = $this->send_seq_no = 0;
|
$this->get_seq_no = $this->send_seq_no = 0;
|
||||||
$this->channel_status = [];
|
$this->channel_status = [];
|
||||||
$this->channel_id_last_interactive = 0;
|
$this->channel_id_last_interactive = 0;
|
||||||
@ -3171,7 +3163,7 @@ class SSH2
|
|||||||
$usec = (int) (1000000 * ($this->curTimeout - $sec));
|
$usec = (int) (1000000 * ($this->curTimeout - $sec));
|
||||||
}
|
}
|
||||||
if ($this->keepAlive > 0) {
|
if ($this->keepAlive > 0) {
|
||||||
$elapsed = microtime(true) - $this->keep_alive_sent;
|
$elapsed = microtime(true) - $this->last_packet;
|
||||||
if ($elapsed < $this->curTimeout) {
|
if ($elapsed < $this->curTimeout) {
|
||||||
$sec = (int) floor($elapsed);
|
$sec = (int) floor($elapsed);
|
||||||
$usec = (int) (1000000 * ($elapsed - $sec));
|
$usec = (int) (1000000 * ($elapsed - $sec));
|
||||||
@ -3233,7 +3225,7 @@ class SSH2
|
|||||||
if (!$packet->packet_length) {
|
if (!$packet->packet_length) {
|
||||||
$this->get_binary_packet_size($packet);
|
$this->get_binary_packet_size($packet);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
if (strlen($packet->raw) != $packet->size) {
|
if (strlen($packet->raw) != $packet->size) {
|
||||||
throw new \RuntimeException('Size of packet was not expected length');
|
throw new \RuntimeException('Size of packet was not expected length');
|
||||||
@ -4041,12 +4033,13 @@ class SSH2
|
|||||||
*/
|
*/
|
||||||
private function send_keep_alive(): void
|
private function send_keep_alive(): void
|
||||||
{
|
{
|
||||||
$elapsed = microtime(true) - $this->keep_alive_sent;
|
if ($this->bitmap & self::MASK_CONNECTED) {
|
||||||
|
$elapsed = microtime(true) - $this->last_packet;
|
||||||
if ($this->keepAlive > 0 && $elapsed >= $this->keepAlive) {
|
if ($this->keepAlive > 0 && $elapsed >= $this->keepAlive) {
|
||||||
$this->keep_alive_sent = microtime(true);
|
|
||||||
$this->send_binary_packet(pack('CN', NET_SSH2_MSG_IGNORE, 0));
|
$this->send_binary_packet(pack('CN', NET_SSH2_MSG_IGNORE, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs data packets
|
* Logs data packets
|
||||||
|
Loading…
x
Reference in New Issue
Block a user