Add retry logic to HTTP Streams
On a 0-byte read or a disconnect, optionally automatically reconnect up to a user specified number of tries with a delay between each attempt.
This commit is contained in:
1 parent
2737dec473
commit
432f892d70
4 files changed
+59
-47
No files matched your search
@@ -43,14 +43,15 @@ class AudioFileSourceHTTPStream : public AudioFileSource
|
||||
virtual bool isOpen() override;
|
||||
virtual uint32_t getSize() override;
|
||||
virtual uint32_t getPos() override;
|
||||
bool SetReconnect(bool val) { reconnect = val; return true; }
|
||||
bool SetReconnect(int tries, int delayms) { reconnectTries = tries; reconnectDelayMs = delayms; return true; }
|
||||
|
||||
private:
|
||||
virtual uint32_t readInternal(void *data, uint32_t len, bool nonBlock);
|
||||
HTTPClient http;
|
||||
int pos;
|
||||
int size;
|
||||
bool reconnect;
|
||||
int reconnectTries;
|
||||
int reconnectDelayMs;
|
||||
char *saveURL;
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user