Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
terrafrost committed Jan 14, 2025
1 parent ee72372 commit 24d7bf5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions phpseclib/Net/SSH2.php
Original file line number Diff line number Diff line change
Expand Up @@ -4182,7 +4182,7 @@ protected function get_channel_packet($client_channel, $skip_extended = false)
$this->errors[count($this->errors) - 1] .= "\r\n$error_message";
}

if (isset($this->server_channels[$channel])) {
if (isset($this->channel_status[$channel]) && $this->channel_status[$channel] != NET_SSH2_MSG_CHANNEL_CLOSE) {
$this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_EOF, $this->server_channels[$channel]));
$this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$channel]));

Expand Down Expand Up @@ -4665,19 +4665,17 @@ private function close_channel($client_channel, $want_reply = false)

if (!$want_reply) {
$this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$client_channel]));
unset($this->channel_status[$client_channel]);
}

$this->channel_status[$client_channel] = NET_SSH2_MSG_CHANNEL_CLOSE;

$this->channelCount--;

$this->curTimeout = 5;

while (!is_bool($this->get_channel_packet($client_channel))) {
}

unset($this->channel_status[$client_channel]);

if ($want_reply) {
$this->send_binary_packet(pack('CN', NET_SSH2_MSG_CHANNEL_CLOSE, $this->server_channels[$client_channel]));
}
Expand Down

0 comments on commit 24d7bf5

Please sign in to comment.