mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2025-12-10 07:44:41 +01:00
Remove cwmp_stop from main process
This commit is contained in:
parent
c4b0fa4272
commit
7a365e2112
5 changed files with 23 additions and 39 deletions
|
|
@ -88,13 +88,10 @@ void cwmp_config_load()
|
||||||
|
|
||||||
global_conf_init();
|
global_conf_init();
|
||||||
|
|
||||||
if (cwmp_stop == true)
|
|
||||||
return;
|
|
||||||
|
|
||||||
cwmp_ctx.net.ipv6_status = is_ipv6_enabled();
|
cwmp_ctx.net.ipv6_status = is_ipv6_enabled();
|
||||||
error = icwmp_check_http_connection();
|
error = icwmp_check_http_connection();
|
||||||
|
|
||||||
while (error != CWMP_OK && cwmp_stop != true) {
|
while (error != CWMP_OK) {
|
||||||
CWMP_LOG(DEBUG, "Init: failed to check http connection");
|
CWMP_LOG(DEBUG, "Init: failed to check http connection");
|
||||||
sleep(UCI_OPTION_READ_INTERVAL);
|
sleep(UCI_OPTION_READ_INTERVAL);
|
||||||
global_conf_init();
|
global_conf_init();
|
||||||
|
|
|
||||||
|
|
@ -214,9 +214,6 @@ static int cwmp_init(void)
|
||||||
cwmp_ctx.prev_heartbeat_interval = cwmp_ctx.conf.heartbeat_interval;
|
cwmp_ctx.prev_heartbeat_interval = cwmp_ctx.conf.heartbeat_interval;
|
||||||
cwmp_ctx.prev_heartbeat_time = cwmp_ctx.conf.heart_time;
|
cwmp_ctx.prev_heartbeat_time = cwmp_ctx.conf.heart_time;
|
||||||
|
|
||||||
if (cwmp_stop == true)
|
|
||||||
return CWMP_GEN_ERR;
|
|
||||||
|
|
||||||
set_cpe_port_conf(cwmp_ctx.conf.connection_request_port);
|
set_cpe_port_conf(cwmp_ctx.conf.connection_request_port);
|
||||||
cwmp_get_deviceid();
|
cwmp_get_deviceid();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -745,6 +745,9 @@ void icwmp_http_server_listen(void)
|
||||||
CWMP_LOG(ERROR, "Could not accept connections for Connection Request!");
|
CWMP_LOG(ERROR, "Could not accept connections for Connection Request!");
|
||||||
shutdown(cwmp_ctx.cr_socket_desc, SHUT_RDWR);
|
shutdown(cwmp_ctx.cr_socket_desc, SHUT_RDWR);
|
||||||
icwmp_http_server_init();
|
icwmp_http_server_init();
|
||||||
|
if (cwmp_stop)
|
||||||
|
return;
|
||||||
|
|
||||||
listen(cwmp_ctx.cr_socket_desc, 5);
|
listen(cwmp_ctx.cr_socket_desc, 5);
|
||||||
cr_request = 0;
|
cr_request = 0;
|
||||||
restrict_start_time = 0;
|
restrict_start_time = 0;
|
||||||
|
|
|
||||||
|
|
@ -799,8 +799,6 @@ void sotfware_version_value_change(struct transfer_complete *p)
|
||||||
void periodic_check_notifiy(struct uloop_timeout *timeout __attribute__((unused)))
|
void periodic_check_notifiy(struct uloop_timeout *timeout __attribute__((unused)))
|
||||||
{
|
{
|
||||||
int is_notify = 0;
|
int is_notify = 0;
|
||||||
if (cwmp_stop)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* If ConnectionRequestURL is empty then reschedule the timer after 5 second for
|
/* If ConnectionRequestURL is empty then reschedule the timer after 5 second for
|
||||||
* maximum of 3 times to check the upstream connection is stable, before enqueing
|
* maximum of 3 times to check the upstream connection is stable, before enqueing
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ int cwmp_schedule_rpc()
|
||||||
struct list_head *ilist;
|
struct list_head *ilist;
|
||||||
struct rpc *rpc_acs;
|
struct rpc *rpc_acs;
|
||||||
|
|
||||||
if (icwmp_http_client_init() || cwmp_stop) {
|
if (icwmp_http_client_init()) {
|
||||||
CWMP_LOG(INFO, "Initializing http client failed");
|
CWMP_LOG(INFO, "Initializing http client failed");
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
@ -140,22 +140,22 @@ int cwmp_schedule_rpc()
|
||||||
cwmp_session_rpc_destructor(rpc_acs);
|
cwmp_session_rpc_destructor(rpc_acs);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!rpc_acs->type || cwmp_stop)
|
if (!rpc_acs->type)
|
||||||
goto retry;
|
goto retry;
|
||||||
|
|
||||||
CWMP_LOG(INFO, "Preparing the %s RPC message to send to the ACS", rpc_acs_methods[rpc_acs->type].name);
|
CWMP_LOG(INFO, "Preparing the %s RPC message to send to the ACS", rpc_acs_methods[rpc_acs->type].name);
|
||||||
if (rpc_acs_methods[rpc_acs->type].prepare_message(rpc_acs) || cwmp_stop)
|
if (rpc_acs_methods[rpc_acs->type].prepare_message(rpc_acs))
|
||||||
goto retry;
|
goto retry;
|
||||||
|
|
||||||
if (xml_set_cwmp_id() || cwmp_stop)
|
if (xml_set_cwmp_id())
|
||||||
goto retry;
|
goto retry;
|
||||||
|
|
||||||
CWMP_LOG(INFO, "Send the %s RPC message to the ACS", rpc_acs_methods[rpc_acs->type].name);
|
CWMP_LOG(INFO, "Send the %s RPC message to the ACS", rpc_acs_methods[rpc_acs->type].name);
|
||||||
if (xml_send_message(rpc_acs) || cwmp_stop)
|
if (xml_send_message(rpc_acs))
|
||||||
goto retry;
|
goto retry;
|
||||||
|
|
||||||
CWMP_LOG(INFO, "Get the %sResponse message from the ACS", rpc_acs_methods[rpc_acs->type].name);
|
CWMP_LOG(INFO, "Get the %sResponse message from the ACS", rpc_acs_methods[rpc_acs->type].name);
|
||||||
if (rpc_acs_methods[rpc_acs->type].parse_response || cwmp_stop)
|
if (rpc_acs_methods[rpc_acs->type].parse_response)
|
||||||
if (rpc_acs_methods[rpc_acs->type].parse_response(rpc_acs))
|
if (rpc_acs_methods[rpc_acs->type].parse_response(rpc_acs))
|
||||||
goto retry;
|
goto retry;
|
||||||
|
|
||||||
|
|
@ -165,37 +165,37 @@ int cwmp_schedule_rpc()
|
||||||
cwmp_session_rpc_destructor(rpc_acs);
|
cwmp_session_rpc_destructor(rpc_acs);
|
||||||
MXML_DELETE(cwmp_ctx.session->tree_in);
|
MXML_DELETE(cwmp_ctx.session->tree_in);
|
||||||
MXML_DELETE(cwmp_ctx.session->tree_out);
|
MXML_DELETE(cwmp_ctx.session->tree_out);
|
||||||
if (cwmp_ctx.session->hold_request || cwmp_stop)
|
if (cwmp_ctx.session->hold_request)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWMP_LOG(INFO, "Send empty message to the ACS");
|
CWMP_LOG(INFO, "Send empty message to the ACS");
|
||||||
if (xml_send_message(NULL) || cwmp_stop)
|
if (xml_send_message(NULL))
|
||||||
goto retry;
|
goto retry;
|
||||||
if (!cwmp_ctx.session->tree_in || cwmp_stop)
|
if (!cwmp_ctx.session->tree_in)
|
||||||
goto next;
|
goto next;
|
||||||
|
|
||||||
CWMP_LOG(INFO, "Receive request from the ACS");
|
CWMP_LOG(INFO, "Receive request from the ACS");
|
||||||
if (xml_handle_message() || cwmp_stop)
|
if (xml_handle_message())
|
||||||
goto retry;
|
goto retry;
|
||||||
|
|
||||||
while (cwmp_ctx.session->rpc_cpe) {
|
while (cwmp_ctx.session->rpc_cpe) {
|
||||||
CWMP_LOG(INFO, "Preparing the %s%s message", rpc_cpe_methods[cwmp_ctx.session->rpc_cpe->type].name, (cwmp_ctx.session->rpc_cpe->type != RPC_CPE_FAULT) ? "Response" : "");
|
CWMP_LOG(INFO, "Preparing the %s%s message", rpc_cpe_methods[cwmp_ctx.session->rpc_cpe->type].name, (cwmp_ctx.session->rpc_cpe->type != RPC_CPE_FAULT) ? "Response" : "");
|
||||||
if (cwmp_rpc_cpe_handle_message(cwmp_ctx.session->rpc_cpe) || cwmp_stop)
|
if (cwmp_rpc_cpe_handle_message(cwmp_ctx.session->rpc_cpe))
|
||||||
goto retry;
|
goto retry;
|
||||||
MXML_DELETE(cwmp_ctx.session->tree_in);
|
MXML_DELETE(cwmp_ctx.session->tree_in);
|
||||||
|
|
||||||
CWMP_LOG(INFO, "Send the %s%s message to the ACS", rpc_cpe_methods[cwmp_ctx.session->rpc_cpe->type].name, (cwmp_ctx.session->rpc_cpe->type != RPC_CPE_FAULT) ? "Response" : "");
|
CWMP_LOG(INFO, "Send the %s%s message to the ACS", rpc_cpe_methods[cwmp_ctx.session->rpc_cpe->type].name, (cwmp_ctx.session->rpc_cpe->type != RPC_CPE_FAULT) ? "Response" : "");
|
||||||
if (xml_send_message(cwmp_ctx.session->rpc_cpe) || cwmp_stop)
|
if (xml_send_message(cwmp_ctx.session->rpc_cpe))
|
||||||
goto retry;
|
goto retry;
|
||||||
MXML_DELETE(cwmp_ctx.session->tree_out);
|
MXML_DELETE(cwmp_ctx.session->tree_out);
|
||||||
FREE(cwmp_ctx.session->rpc_cpe);
|
FREE(cwmp_ctx.session->rpc_cpe);
|
||||||
|
|
||||||
if (!cwmp_ctx.session->tree_in || cwmp_stop)
|
if (!cwmp_ctx.session->tree_in)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
CWMP_LOG(INFO, "Receive request from the ACS");
|
CWMP_LOG(INFO, "Receive request from the ACS");
|
||||||
if (xml_handle_message() || cwmp_stop)
|
if (xml_handle_message())
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -368,14 +368,12 @@ void start_cwmp_session(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_ipv6_status_changed()) {
|
if (is_ipv6_status_changed()) {
|
||||||
if (icwmp_check_http_connection() != CWMP_OK || cwmp_stop) {
|
if (icwmp_check_http_connection() != CWMP_OK) {
|
||||||
CWMP_LOG(INFO, "Failed to check http connection");
|
CWMP_LOG(INFO, "Failed to check http connection");
|
||||||
if (!cwmp_stop) {
|
|
||||||
/* clear inform and getrpc method from rpc list.
|
/* clear inform and getrpc method from rpc list.
|
||||||
* These will be added in next session init */
|
* These will be added in next session init */
|
||||||
remove_inform_getrpc();
|
remove_inform_getrpc();
|
||||||
schedule_session_retry();
|
schedule_session_retry();
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -424,15 +422,6 @@ void start_cwmp_session(void)
|
||||||
*/
|
*/
|
||||||
CWMP_LOG(INFO, "End session");
|
CWMP_LOG(INFO, "End session");
|
||||||
|
|
||||||
if (cwmp_stop) {
|
|
||||||
cwmp_remove_all_session_events();
|
|
||||||
run_session_end_func();
|
|
||||||
rpc_exit();
|
|
||||||
icwmp_cleanmem();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cwmp_ctx.session->error == CWMP_RETRY_SESSION && (!list_empty(&(cwmp_ctx.session->events)) || (list_empty(&(cwmp_ctx.session->events)) && cwmp_ctx.cwmp_cr_event == 0))) { //CWMP Retry session
|
if (cwmp_ctx.session->error == CWMP_RETRY_SESSION && (!list_empty(&(cwmp_ctx.session->events)) || (list_empty(&(cwmp_ctx.session->events)) && cwmp_ctx.cwmp_cr_event == 0))) { //CWMP Retry session
|
||||||
// clear inform and getrpc method from rpc list. These will be added in next session init
|
// clear inform and getrpc method from rpc list. These will be added in next session init
|
||||||
remove_inform_getrpc();
|
remove_inform_getrpc();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue