parent
1d1556fb07
commit
9fe48bc1ae
|
@ -1201,7 +1201,7 @@ int opendhcp_add_listener() {
|
|||
return i;
|
||||
}
|
||||
|
||||
void on_http_response_cb(void *pData,
|
||||
static void on_http_response_cb(void *pData,
|
||||
unsigned int size,
|
||||
const char *pReqUrl,
|
||||
const char *pDlPath,
|
||||
|
@ -1215,6 +1215,8 @@ void on_http_response_cb(void *pData,
|
|||
} else {
|
||||
dzlog_error("Download Error Code: %d\n", iFinished);
|
||||
}
|
||||
|
||||
free(pUserData);
|
||||
}
|
||||
|
||||
void iptvCacheCb(void *UNUSED(pArg)) {
|
||||
|
@ -1262,9 +1264,7 @@ void iptvCacheCb(void *UNUSED(pArg)) {
|
|||
const char *pStrPro = proto_create_new(pRspMsg, 200);
|
||||
|
||||
// Report new IPTV device MAC
|
||||
inet_http_post_async(config_get_agent_iptv_report_url(), pStrPro, on_http_response_cb, nullptr);
|
||||
|
||||
free((void *)pStrPro);
|
||||
inet_http_post_async(pUrl, pStrPro, on_http_response_cb, (void *)pStrPro);
|
||||
}
|
||||
|
||||
uv_sleep(10);
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#ifdef OPENDHCPD_ON
|
||||
#include "proto.h"
|
||||
#include "inet_misc.h"
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef OPENDHCPDDNS_ON
|
||||
|
@ -48,6 +50,31 @@ static void lwip_init_env() {
|
|||
}
|
||||
#endif
|
||||
|
||||
cJSON *create_app_process_status(int isStart) {
|
||||
cJSON *pRspMsg = cJSON_CreateObject();
|
||||
cJSON_AddNumberToObject(pRspMsg, "vni", cfg_get_user_vni_id());
|
||||
cJSON_AddStringToObject(pRspMsg, "process", isStart ? "setup" : "exit");
|
||||
return pRspMsg;
|
||||
}
|
||||
|
||||
static void on_http_response_cb(void *pData,
|
||||
unsigned int size,
|
||||
const char *pReqUrl,
|
||||
const char *pDlPath,
|
||||
const char *pTaskUuid,
|
||||
int iFinished,
|
||||
void *pUserData) {
|
||||
if (iFinished == 0) {
|
||||
dzlog_debug("Request(%s): [%s] Response: [%u] OK:\n", pTaskUuid, pReqUrl, size);
|
||||
} else if (iFinished == 1) {
|
||||
dzlog_error("Request(%s): [%s] Response: [%u] Error\n", pTaskUuid, pReqUrl, size);
|
||||
} else {
|
||||
dzlog_error("Download Error Code: %d\n", iFinished);
|
||||
}
|
||||
|
||||
free(pUserData);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int ret;
|
||||
#ifdef OPENDHCPDDNS_ON
|
||||
|
@ -76,8 +103,13 @@ int main(int argc, char **argv) {
|
|||
pppoe_session_init();
|
||||
#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();
|
||||
|
||||
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 *)pStrSetup);
|
||||
|
||||
while (!is_system_cleanup()) {
|
||||
sleep(1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue