Add timeout and HTTP size to streamer EOF checks

HTTPStreamer assumed the server would drop the connection when no more
data was available to be transferred from the source file.
For individual files, though, the web server will send the expected length
in the headers and leave the connection open (i.e. to recycle the connection
and accelerate web browsing).  In this case, the streamer would effectively
hang waiting for more data than was being transmitted.

Now check the read data against the expected data, and also add a 0.5s
timeout no matter what to the reading.

Tested on streaming and served files, seems to work fine.
This commit is contained in:
Earle F. Philhower, III committed 2017-10-22 10:04:19 -07:00
1 parent 2dac08ef4e
commit c5da8c3062
2 files changed
+11 -3

No files matched your search

+2 -1
View File
@@ -43,7 +43,8 @@ class AudioFileSourceHTTPStream : public AudioFileSource
private:
HTTPClient http;
uint32_t pos;
int pos;
int size;
};