diff --git a/phpseclib/Net/SFTP.php b/phpseclib/Net/SFTP.php index 4984156b..1fc794db 100644 --- a/phpseclib/Net/SFTP.php +++ b/phpseclib/Net/SFTP.php @@ -1701,13 +1701,6 @@ class Net_SFTP extends Net_SSH2 } $i++; - - if ($i >= NET_SFTP_QUEUE_SIZE) { - if (!$this->_read_put_responses($i)) { - return false; - } - $i = 0; - } } } @@ -1717,11 +1710,8 @@ class Net_SFTP extends Net_SSH2 $i++; - if ($i >= NET_SFTP_QUEUE_SIZE) { - if (!$this->_read_put_responses($i)) { - return false; - } - $i = 0; + if (!$this->_read_put_responses($i)) { + return false; } return true; @@ -2091,7 +2081,7 @@ class Net_SFTP extends Net_SSH2 $subtemp = $offset + $sent; $packet = pack('Na*N3a*', strlen($handle), $handle, $subtemp / 4294967296, $subtemp, strlen($temp), $temp); - if (!$this->_send_sftp_packet(NET_SFTP_WRITE, $packet)) { + if (!$this->_send_sftp_packet(NET_SFTP_WRITE, $packet, $i)) { if ($mode & NET_SFTP_LOCAL_FILE) { fclose($fp); } @@ -2103,14 +2093,6 @@ class Net_SFTP extends Net_SSH2 } $i++; - - if ($i == NET_SFTP_QUEUE_SIZE) { - if (!$this->_read_put_responses($i)) { - $i = 0; - break; - } - $i = 0; - } } if (!$this->_read_put_responses($i)) { @@ -2398,10 +2380,8 @@ class Net_SFTP extends Net_SSH2 if (!$recursive) { return false; } - $i = 0; - $result = $this->_delete_recursive($path, $i); - $this->_read_put_responses($i); - return $result; + + return $this->_delete_recursive($path); } $this->_remove_from_stat_cache($path); @@ -2419,11 +2399,8 @@ class Net_SFTP extends Net_SSH2 * @return bool * @access private */ - function _delete_recursive($path, &$i) + function _delete_recursive($path) { - if (!$this->_read_put_responses($i)) { - return false; - } $i = 0; $entries = $this->_list($path, true); @@ -2451,13 +2428,6 @@ class Net_SFTP extends Net_SSH2 $this->_remove_from_stat_cache($temp); $i++; - - if ($i >= NET_SFTP_QUEUE_SIZE) { - if (!$this->_read_put_responses($i)) { - return false; - } - $i = 0; - } } } @@ -2468,11 +2438,8 @@ class Net_SFTP extends Net_SSH2 $i++; - if ($i >= NET_SFTP_QUEUE_SIZE) { - if (!$this->_read_put_responses($i)) { - return false; - } - $i = 0; + if (!$this->_read_put_responses($i)) { + return false; } return true;