From 18e296c19cb4de6c030b81ee6d3e8b9b9d1fab31 Mon Sep 17 00:00:00 2001 From: huangxin Date: Wed, 15 Mar 2023 14:19:49 +0800 Subject: [PATCH] =?UTF-8?q?OCT=201.=20=E6=A0=B9=E6=8D=AE=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=A1=B9=E5=BC=80=E5=85=B3=E5=86=B3=E5=AE=9A=E5=85=B3=E9=97=AD?= =?UTF-8?q?vcpe=E5=90=AF=E5=8A=A8=E3=80=81=E9=80=80=E5=87=BA=E5=90=91Agent?= =?UTF-8?q?=E5=8F=91=E9=80=81=E9=80=9A=E7=9F=A5=E5=AE=8F=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/vcpe.cfg | 2 +- srcs/vcpe_main.c | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/config/vcpe.cfg b/config/vcpe.cfg index 2458966..7292984 100644 --- a/config/vcpe.cfg +++ b/config/vcpe.cfg @@ -13,7 +13,7 @@ application: }; agent: { - iptv_report_url = ""; # IPTV 设备上报接口 + iptv_report_url = "http://10.0.0.1:50012/vcpe/dhcp/info"; # IPTV 设备上报接口 moniter_rep_url = ""; # vCPE设备上下线接口 }; diff --git a/srcs/vcpe_main.c b/srcs/vcpe_main.c index 65d8979..409781b 100644 --- a/srcs/vcpe_main.c +++ b/srcs/vcpe_main.c @@ -4,12 +4,11 @@ #include #include #include +#include #include "cmdline.h" #include "task_manager.h" #include "init.h" -#ifdef NOTIFY_VCPE_STATUS #include "inet_misc.h" -#endif #include "config.h" #include "zlog_module.h" @@ -50,7 +49,6 @@ static void lwip_init_env() { } #endif -#ifdef NOTIFY_VCPE_STATUS cJSON *create_app_process_status(int isStart) { cJSON *pRspMsg = cJSON_CreateObject(); #ifdef USERVNI_ON @@ -77,10 +75,11 @@ static void on_http_response_cb(void *pData, free(pUserData); } -#endif int main(int argc, char **argv) { - int ret; + int ret; + const char *pRspUrl; + #ifdef OPENDHCPDDNS_ON return dual_server_main(argc, argv); #else @@ -107,17 +106,19 @@ int main(int argc, char **argv) { pppoe_session_init(); #endif -#ifdef NOTIFY_VCPE_STATUS - const char *pStrSetup = proto_create_new(create_app_process_status(1), 200); - inet_http_post_async(config_get_agent_moniter_report_url(), pStrSetup, on_http_response_cb, (void *)pStrSetup); -#endif + pRspUrl = config_get_agent_moniter_report_url(); + + if (pRspUrl && strlen(pRspUrl) > 0) { + const char *pStrSetup = proto_create_new(create_app_process_status(1), 200); + inet_http_post_async(config_get_agent_moniter_report_url(), pStrSetup, on_http_response_cb, (void *)pStrSetup); + } task_manager_run(); -#ifdef NOTIFY_VCPE_STATUS - const char *pStrExit = proto_create_new(create_app_process_status(0), 200); - inet_http_post_async(config_get_agent_moniter_report_url(), pStrSetup, on_http_response_cb, (void *)pStrExit); -#endif + if (pRspUrl && strlen(pRspUrl) > 0) { + const char *pStrExit = proto_create_new(create_app_process_status(0), 200); + inet_http_post_async(config_get_agent_moniter_report_url(), pStrExit, on_http_response_cb, (void *)pStrExit); + } while (!is_system_cleanup()) { sleep(1);