Merge branch '3.0'

This commit is contained in:
terrafrost 2020-12-23 10:41:04 -06:00
commit a2b390d725

View File

@ -1251,7 +1251,7 @@ class SSH2
$start = microtime(true); $start = microtime(true);
$sec = floor($this->curTimeout); $sec = floor($this->curTimeout);
$usec = 1000000 * ($this->curTimeout - $sec); $usec = 1000000 * ($this->curTimeout - $sec);
if (stream_select($read, $write, $except, $sec, $usec) === false) { if (@stream_select($read, $write, $except, $sec, $usec) === false) {
$this->is_timeout = true; $this->is_timeout = true;
return false; return false;
} }
@ -3194,9 +3194,9 @@ class SSH2
if ($this->curTimeout <= 0) { if ($this->curTimeout <= 0) {
if ($this->keepAlive <= 0) { if ($this->keepAlive <= 0) {
stream_select($read, $write, $except, null); @stream_select($read, $write, $except, null);
} else { } else {
if (!stream_select($read, $write, $except, $this->keepAlive)) { if (!@stream_select($read, $write, $except, $this->keepAlive)) {
$this->send_binary_packet(pack('CN', NET_SSH2_MSG_IGNORE, 0)); $this->send_binary_packet(pack('CN', NET_SSH2_MSG_IGNORE, 0));
return $this->get_binary_packet(true); return $this->get_binary_packet(true);
} }
@ -3213,7 +3213,7 @@ class SSH2
$start = microtime(true); $start = microtime(true);
if ($this->keepAlive > 0 && $this->keepAlive < $this->curTimeout) { if ($this->keepAlive > 0 && $this->keepAlive < $this->curTimeout) {
if (!stream_select($read, $write, $except, $this->keepAlive)) { if (!@stream_select($read, $write, $except, $this->keepAlive)) {
$this->send_binary_packet(pack('CN', NET_SSH2_MSG_IGNORE, 0)); $this->send_binary_packet(pack('CN', NET_SSH2_MSG_IGNORE, 0));
$elapsed = microtime(true) - $start; $elapsed = microtime(true) - $start;
$this->curTimeout-= $elapsed; $this->curTimeout-= $elapsed;
@ -3226,8 +3226,8 @@ class SSH2
$sec = floor($this->curTimeout); $sec = floor($this->curTimeout);
$usec = 1000000 * ($this->curTimeout - $sec); $usec = 1000000 * ($this->curTimeout - $sec);
// on windows this returns a "Warning: Invalid CRT parameters detected" error // this can return a "stream_select(): unable to select [4]: Interrupted system call" error
if (!stream_select($read, $write, $except, $sec, $usec)) { if (!@stream_select($read, $write, $except, $sec, $usec)) {
$this->is_timeout = true; $this->is_timeout = true;
return true; return true;
} }