summaryrefslogtreecommitdiffstats
path: root/apps/files_external/3rdparty/icewind
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-06-21 11:43:15 +0200
committerGitHub <noreply@github.com>2016-06-21 11:43:15 +0200
commite6895cb3b5f991a3949db8eee1465166a1205135 (patch)
treeef7fa75d1b4da812de80e93c3590dbb5404d7f06 /apps/files_external/3rdparty/icewind
parentb4df57f3f02f65ed71d1072280751170379a53e8 (diff)
parent2b493e2f9dca674ba11f88a1d182d6872e04eaaa (diff)
downloadnextcloud-server-e6895cb3b5f991a3949db8eee1465166a1205135.tar.gz
nextcloud-server-e6895cb3b5f991a3949db8eee1465166a1205135.zip
Merge pull request #186 from nextcloud/master-sync-upstream
[master] sync upstream - 21.06.2016
Diffstat (limited to 'apps/files_external/3rdparty/icewind')
-rw-r--r--apps/files_external/3rdparty/icewind/streams/src/RetryWrapper.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/apps/files_external/3rdparty/icewind/streams/src/RetryWrapper.php b/apps/files_external/3rdparty/icewind/streams/src/RetryWrapper.php
index 84b43f6bd02..8238f19f7c9 100644
--- a/apps/files_external/3rdparty/icewind/streams/src/RetryWrapper.php
+++ b/apps/files_external/3rdparty/icewind/streams/src/RetryWrapper.php
@@ -44,7 +44,7 @@ class RetryWrapper extends Wrapper {
$result = parent::stream_read($count);
$bytesReceived = strlen($result);
- while ($bytesReceived < $count && !$this->stream_eof()) {
+ while (strlen($result) > 0 && $bytesReceived < $count && !$this->stream_eof()) {
$result .= parent::stream_read($count - $bytesReceived);
$bytesReceived = strlen($result);
}
@@ -54,11 +54,13 @@ class RetryWrapper extends Wrapper {
public function stream_write($data) {
$bytesToSend = strlen($data);
- $result = parent::stream_write($data);
+ $bytesWritten = parent::stream_write($data);
+ $result = $bytesWritten;
- while ($result < $bytesToSend && !$this->stream_eof()) {
+ while ($bytesWritten > 0 && $result < $bytesToSend && !$this->stream_eof()) {
$dataLeft = substr($data, $result);
- $result += parent::stream_write($dataLeft);
+ $bytesWritten = parent::stream_write($dataLeft);
+ $result += $bytesWritten;
}
return $result;