From b9fa5f9b5e4f2189979edfd7be444ad4773b8a8a Mon Sep 17 00:00:00 2001 From: xia-chu <771730766@qq.com> Date: Mon, 13 Mar 2023 20:29:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E4=BE=8B=E6=B1=87=E6=8A=A5=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E6=94=B9=E6=88=9060=E5=88=86=E9=92=9F=E4=B8=80?= =?UTF-8?q?=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 同时新增程序启动日期、是否开启编译ffmpeg选项 --- src/Http/HttpRequester.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Http/HttpRequester.cpp b/src/Http/HttpRequester.cpp index a7885919..6833e44f 100644 --- a/src/Http/HttpRequester.cpp +++ b/src/Http/HttpRequester.cpp @@ -52,7 +52,6 @@ void HttpRequester::setOnResult(const HttpRequesterResult &onResult) { //////////////////////////////////////////////////////////////////////// #if !defined(DISABLE_REPORT) -static constexpr auto s_interval_second = 60 * 5; static constexpr auto s_report_url = "http://report.zlmediakit.com:8888/index/api/report"; extern const char kServerName[]; @@ -112,6 +111,7 @@ static std::string httpBody() { args["build_date"] = __DATE__; args["version"] = kServerName; args["exe_name"] = exeName(); + args["start_time"] = getTimeStr("%Y-%m-%d %H:%M:%S"); #if NDEBUG args["release"] = 1; @@ -161,6 +161,12 @@ static std::string httpBody() { args["openssl"] = 0; #endif +#if ENABLE_FFMPEG + args["ffmpeg"] = 1; +#else + args["ffmpeg"] = 0; +#endif + args["rand_str"] = makeRandStr(32); for (auto &pr : mINI::Instance()) { // 只获取转协议相关配置 @@ -178,14 +184,17 @@ static void sendReport() { requester->setMethod("POST"); requester->setBody(body); - requester->startRequester(s_report_url, nullptr, s_interval_second); + // http超时时间设置为30秒 + requester->startRequester(s_report_url, nullptr, 30); } static toolkit::onceToken s_token([]() { NoticeCenter::Instance().addListener(nullptr, EventPollerPool::kOnStarted, [](EventPollerPool &pool, size_t &size) { - pool.getPoller()->doDelayTask(s_interval_second * 1000, []() { + // 第一次汇报在程序启动后5分钟 + pool.getPoller()->doDelayTask(5 * 60 * 1000, []() { sendReport(); - return s_interval_second * 1000; + // 后续每一个小时汇报一次 + return 60 * 60 * 1000; }); }); });