OCT 1. 根据配置项开关决定关闭vcpe启动、退出向Agent发送通知宏定义开关

This commit is contained in:
huangxin 2023-03-15 14:19:49 +08:00
parent 50aba54eae
commit 18e296c19c
2 changed files with 15 additions and 14 deletions

View File

@ -13,7 +13,7 @@ application:
}; };
agent: { agent: {
iptv_report_url = ""; # IPTV 设备上报接口 iptv_report_url = "http://10.0.0.1:50012/vcpe/dhcp/info"; # IPTV 设备上报接口
moniter_rep_url = ""; # vCPE设备上下线接口 moniter_rep_url = ""; # vCPE设备上下线接口
}; };

View File

@ -4,12 +4,11 @@
#include <uv.h> #include <uv.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h>
#include "cmdline.h" #include "cmdline.h"
#include "task_manager.h" #include "task_manager.h"
#include "init.h" #include "init.h"
#ifdef NOTIFY_VCPE_STATUS
#include "inet_misc.h" #include "inet_misc.h"
#endif
#include "config.h" #include "config.h"
#include "zlog_module.h" #include "zlog_module.h"
@ -50,7 +49,6 @@ static void lwip_init_env() {
} }
#endif #endif
#ifdef NOTIFY_VCPE_STATUS
cJSON *create_app_process_status(int isStart) { cJSON *create_app_process_status(int isStart) {
cJSON *pRspMsg = cJSON_CreateObject(); cJSON *pRspMsg = cJSON_CreateObject();
#ifdef USERVNI_ON #ifdef USERVNI_ON
@ -77,10 +75,11 @@ static void on_http_response_cb(void *pData,
free(pUserData); free(pUserData);
} }
#endif
int main(int argc, char **argv) { int main(int argc, char **argv) {
int ret; int ret;
const char *pRspUrl;
#ifdef OPENDHCPDDNS_ON #ifdef OPENDHCPDDNS_ON
return dual_server_main(argc, argv); return dual_server_main(argc, argv);
#else #else
@ -107,17 +106,19 @@ int main(int argc, char **argv) {
pppoe_session_init(); pppoe_session_init();
#endif #endif
#ifdef NOTIFY_VCPE_STATUS pRspUrl = config_get_agent_moniter_report_url();
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); if (pRspUrl && strlen(pRspUrl) > 0) {
#endif 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(); task_manager_run();
#ifdef NOTIFY_VCPE_STATUS if (pRspUrl && strlen(pRspUrl) > 0) {
const char *pStrExit = proto_create_new(create_app_process_status(0), 200); 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); inet_http_post_async(config_get_agent_moniter_report_url(), pStrExit, on_http_response_cb, (void *)pStrExit);
#endif }
while (!is_system_cleanup()) { while (!is_system_cleanup()) {
sleep(1); sleep(1);