MCPcopy Create free account
hub / github.com/error311/FileRise / pump

Method pump

src/FileRise/Storage/CurlReadStream.php:175–204  ·  view source on GitHub ↗
(int $desiredBytes)

Source from the content-addressed store, hash-verified

173 }
174
175 private function pump(int $desiredBytes): void
176 {
177 while (!$this->done && !$this->closed && $this->availableBytes() < $desiredBytes) {
178 $running = 0;
179 do {
180 $status = curl_multi_exec($this->multiHandle, $running);
181 } while ($status === CURLM_CALL_MULTI_PERFORM);
182
183 if ($status !== CURLM_OK) {
184 $this->fail('WebDAV read failed to progress.');
185 return;
186 }
187
188 $this->collectCompletedTransfers();
189 if ($this->done || $this->availableBytes() >= $desiredBytes) {
190 break;
191 }
192
193 if ($running <= 0) {
194 $this->done = true;
195 $this->closeCurlHandles();
196 break;
197 }
198
199 $selected = curl_multi_select($this->multiHandle, 1.0);
200 if ($selected === -1) {
201 usleep(10000);
202 }
203 }
204 }
205
206 private function collectCompletedTransfers(): void
207 {

Callers 1

readMethod · 0.95

Calls 4

availableBytesMethod · 0.95
failMethod · 0.95
closeCurlHandlesMethod · 0.95

Tested by

no test coverage detected