mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-14 20:15:58 +08:00
HttpRequester支持失败重试功能(#2323)
This commit is contained in:
@@ -25,6 +25,10 @@ public:
|
||||
|
||||
void setOnResult(const HttpRequesterResult &onResult);
|
||||
void startRequester(const std::string &url, const HttpRequesterResult &on_result, float timeout_sec = 10);
|
||||
void setRetry(size_t count, size_t delay);
|
||||
size_t getRetry() const { return _retry; }
|
||||
size_t getRetryDelay() const { return _retry_delay; }
|
||||
size_t getMaxRetry() const { return _max_retry; }
|
||||
void clear() override;
|
||||
|
||||
private:
|
||||
@@ -33,6 +37,9 @@ private:
|
||||
void onResponseCompleted(const toolkit::SockException &ex) override;
|
||||
|
||||
private:
|
||||
size_t _retry = 0;
|
||||
size_t _max_retry = 0;
|
||||
size_t _retry_delay = 2000; // ms
|
||||
std::string _res_body;
|
||||
HttpRequesterResult _on_result;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user