1
0
mirror of https://github.com/danog/phpseclib.git synced 2024-12-13 09:37:37 +01:00

Merge branch '2.0' into 3.0

This commit is contained in:
terrafrost 2020-02-25 00:00:25 -06:00
commit 8c8e805c73

View File

@ -1568,6 +1568,13 @@ class SFTP extends SSH2
} }
$i++; $i++;
if ($i >= NET_SFTP_QUEUE_SIZE) {
if (!$this->read_put_responses($i)) {
return false;
}
$i = 0;
}
} }
} }
@ -1577,8 +1584,11 @@ class SFTP extends SSH2
$i++; $i++;
if (!$this->read_put_responses($i)) { if ($i >= NET_SFTP_QUEUE_SIZE) {
return false; if (!$this->read_put_responses($i)) {
return false;
}
$i = 0;
} }
return true; return true;
@ -1940,7 +1950,7 @@ class SFTP extends SSH2
$subtemp = $offset + $sent; $subtemp = $offset + $sent;
$packet = pack('Na*N3a*', strlen($handle), $handle, $subtemp / 4294967296, $subtemp, strlen($temp), $temp); $packet = pack('Na*N3a*', strlen($handle), $handle, $subtemp / 4294967296, $subtemp, strlen($temp), $temp);
if (!$this->send_sftp_packet(NET_SFTP_WRITE, $packet, $i)) { if (!$this->send_sftp_packet(NET_SFTP_WRITE, $packet)) {
if ($mode & self::SOURCE_LOCAL_FILE) { if ($mode & self::SOURCE_LOCAL_FILE) {
fclose($fp); fclose($fp);
} }
@ -1952,6 +1962,14 @@ class SFTP extends SSH2
} }
$i++; $i++;
if ($i == NET_SFTP_QUEUE_SIZE) {
if (!$this->read_put_responses($i)) {
$i = 0;
break;
}
$i = 0;
}
} }
if (!$this->read_put_responses($i)) { if (!$this->read_put_responses($i)) {
@ -2236,7 +2254,10 @@ class SFTP extends SSH2
return false; return false;
} }
return $this->delete_recursive($path); $i = 0;
$result = $this->delete_recursive($path, $i);
$this->read_put_responses($i);
return $result;
} }
$this->remove_from_stat_cache($path); $this->remove_from_stat_cache($path);
@ -2254,8 +2275,11 @@ class SFTP extends SSH2
* @return bool * @return bool
* @access private * @access private
*/ */
private function delete_recursive($path) private function delete_recursive($path, &$i)
{ {
if (!$this->read_put_responses($i)) {
return false;
}
$i = 0; $i = 0;
$entries = $this->readlist($path, true); $entries = $this->readlist($path, true);
@ -2283,6 +2307,13 @@ class SFTP extends SSH2
$this->remove_from_stat_cache($temp); $this->remove_from_stat_cache($temp);
$i++; $i++;
if ($i >= NET_SFTP_QUEUE_SIZE) {
if (!$this->read_put_responses($i)) {
return false;
}
$i = 0;
}
} }
} }
@ -2293,8 +2324,11 @@ class SFTP extends SSH2
$i++; $i++;
if (!$this->read_put_responses($i)) { if ($i >= NET_SFTP_QUEUE_SIZE) {
return false; if (!$this->read_put_responses($i)) {
return false;
}
$i = 0;
} }
return true; return true;