| 382 | } |
| 383 | |
| 384 | void HttpDataStream::ResetFileHandles() { |
| 385 | if (this->writeFile) { |
| 386 | fclose(this->writeFile); |
| 387 | this->writeFile = nullptr; |
| 388 | } |
| 389 | |
| 390 | if (this->reader) { |
| 391 | this->reader->Interrupt(); |
| 392 | this->reader.reset(); |
| 393 | } |
| 394 | |
| 395 | auto const id = cacheId(httpUri); |
| 396 | diskCache.Delete(id, this->instanceId); |
| 397 | this->writeFile = diskCache.Open(id, this->instanceId, "wb"); |
| 398 | if (this->writeFile) { |
| 399 | this->reader = std::make_shared<FileReadStream>(this->httpUri, this->instanceId); |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | void HttpDataStream::ThreadProc() { |
| 404 | if (this->curlEasy) { |