diff --git a/phpseclib/Net/SFTP.php b/phpseclib/Net/SFTP.php index 451a2cbd..55d63f0b 100644 --- a/phpseclib/Net/SFTP.php +++ b/phpseclib/Net/SFTP.php @@ -813,7 +813,8 @@ class Net_SFTP extends Net_SSH2 return false; } $this->canonicalize_paths = false; - $this->_reset_connection(NET_SSH2_DISCONNECT_CONNECTION_LOST); + $this->_reset_sftp(); + return $this->_init_sftp_connection(); } $this->_update_stat_cache($this->pwd, array()); @@ -3683,6 +3684,19 @@ class Net_SFTP extends Net_SSH2 return $result; } + /** + * Resets the SFTP channel for re-use + * + * @access private + */ + function _reset_sftp() + { + $this->use_request_id = false; + $this->pwd = false; + $this->requestBuffer = []; + $this->partial_init = false; + } + /** * Resets a connection for re-use * @@ -3692,10 +3706,7 @@ class Net_SFTP extends Net_SSH2 function _reset_connection($reason) { parent::_reset_connection($reason); - $this->use_request_id = false; - $this->pwd = false; - $this->requestBuffer = array(); - $this->partial_init = false; + $this->_reset_sftp(); } /**