Commit f69204b3 by 夏楚 Committed by GitHub

hook请求添加hook_index, 防止hook请求乱序 (#2758)

parent 2e05119d
...@@ -164,12 +164,16 @@ string getVhost(const HttpArgs &value) { ...@@ -164,12 +164,16 @@ string getVhost(const HttpArgs &value) {
return val != value.end() ? val->second : ""; return val != value.end() ? val->second : "";
} }
static atomic<uint64_t> s_hook_index { 0 };
void do_http_hook(const string &url, const ArgsType &body, const function<void(const Value &, const string &)> &func, uint32_t retry) { void do_http_hook(const string &url, const ArgsType &body, const function<void(const Value &, const string &)> &func, uint32_t retry) {
GET_CONFIG(string, mediaServerId, General::kMediaServerId); GET_CONFIG(string, mediaServerId, General::kMediaServerId);
GET_CONFIG(float, hook_timeoutSec, Hook::kTimeoutSec); GET_CONFIG(float, hook_timeoutSec, Hook::kTimeoutSec);
GET_CONFIG(float, retry_delay, Hook::kRetryDelay); GET_CONFIG(float, retry_delay, Hook::kRetryDelay);
const_cast<ArgsType &>(body)["mediaServerId"] = mediaServerId; const_cast<ArgsType &>(body)["mediaServerId"] = mediaServerId;
const_cast<ArgsType &>(body)["hook_index"] = s_hook_index++;
auto requester = std::make_shared<HttpRequester>(); auto requester = std::make_shared<HttpRequester>();
requester->setMethod("POST"); requester->setMethod("POST");
auto bodyStr = to_string(body); auto bodyStr = to_string(body);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论