Skip to content

Commit 43b2708

Browse files
committed
Merge branch 'keepalive-1.0' into keepalive-2.0
2 parents d904f08 + f0501ff commit 43b2708

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

phpseclib/Net/SSH2.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3377,9 +3377,6 @@ function _get_binary_packet($skip_channel_filter = false)
33773377
// on windows this returns a "Warning: Invalid CRT parameters detected" error
33783378
if (!@stream_select($read, $write, $except, $sec, $usec) && !count($read)) {
33793379
$this->is_timeout = true;
3380-
if ($client_channel == self::CHANNEL_EXEC && !$this->request_pty) {
3381-
$this->_close_channel($client_channel);
3382-
}
33833380
return true;
33843381
}
33853382
$elapsed = microtime(true) - $start;
@@ -3747,6 +3744,9 @@ function _get_channel_packet($client_channel, $skip_extended = false)
37473744
$this->binary_packet_buffer = false;
37483745
} else {
37493746
$response = $this->_get_binary_packet(true);
3747+
if ($response === true && $this->is_timeout && $client_channel == self::CHANNEL_EXEC && !$this->request_pty) {
3748+
$this->_close_channel($client_channel);
3749+
}
37503750
if ($response === false) {
37513751
$this->bitmap = 0;
37523752
user_error('Connection closed by server');

0 commit comments

Comments
 (0)