From f2724261f1a6942886248e0363774e0f69f571f2 Mon Sep 17 00:00:00 2001 From: casey langen Date: Sun, 18 Oct 2020 14:50:03 -0700 Subject: [PATCH] fwrite() more aggressively in HttpDataStream so data is available immediately to readers. --- src/plugins/httpdatastream/HttpDataStream.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/httpdatastream/HttpDataStream.cpp b/src/plugins/httpdatastream/HttpDataStream.cpp index d677cc07b..5207b8197 100755 --- a/src/plugins/httpdatastream/HttpDataStream.cpp +++ b/src/plugins/httpdatastream/HttpDataStream.cpp @@ -464,10 +464,11 @@ size_t HttpDataStream::CurlWriteCallback(char *ptr, size_t size, size_t nmemb, v size_t total = size * nmemb; size_t result = fwrite(ptr, size, nmemb, stream->writeFile); + fflush(stream->writeFile); /* normally we wouldn't want to do this, but it ensures + data written is available immediately to any simultaneous readers */ stream->written += result; if (stream->written >= stream->chunkSizeBytes) { - fflush(stream->writeFile); stream->reader->Add(stream->written); stream->written = 0; }