mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-03 23:39:41 +00:00
Fixed a couple long-dormant bugs in HttpDataStream
This commit is contained in:
parent
0d11e3da12
commit
e966b36b24
@ -161,7 +161,7 @@ class FileReadStream {
|
|||||||
this->underflow.wait(lock);
|
this->underflow.wait(lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->interrupted && this->Eof()) {
|
if (this->interrupted || this->Eof()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,13 +377,14 @@ void HttpDataStream::ThreadProc() {
|
|||||||
|
|
||||||
bool HttpDataStream::Close() {
|
bool HttpDataStream::Close() {
|
||||||
this->Interrupt();
|
this->Interrupt();
|
||||||
this->reader.reset();
|
|
||||||
|
|
||||||
if (this->downloadThread) {
|
if (this->downloadThread) {
|
||||||
downloadThread->join();
|
downloadThread->join();
|
||||||
this->downloadThread.reset();
|
this->downloadThread.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->reader.reset();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,7 +436,6 @@ size_t HttpDataStream::CurlWriteCallback(char *ptr, size_t size, size_t nmemb, v
|
|||||||
size_t result = fwrite(ptr, size, nmemb, stream->writeFile);
|
size_t result = fwrite(ptr, size, nmemb, stream->writeFile);
|
||||||
stream->written += result;
|
stream->written += result;
|
||||||
|
|
||||||
|
|
||||||
if (stream->written >= NOTIFY_INTERVAL_BYTES) {
|
if (stream->written >= NOTIFY_INTERVAL_BYTES) {
|
||||||
fflush(stream->writeFile);
|
fflush(stream->writeFile);
|
||||||
stream->reader->Add(stream->written);
|
stream->reader->Add(stream->written);
|
||||||
|
Loading…
Reference in New Issue
Block a user