Skip to content
Snippets Groups Projects

chore(ci): properly shutting down HTTP/2 server

Merged Raphael Defosseux requested to merge fix-http2-shutdown into develop
+ 30
11
@@ -63,35 +63,54 @@ void send_heartbeat_to_tasks(const uint32_t sequence) {
//------------------------------------------------------------------------------
void my_app_signal_handler(int s) {
// Setting log level arbitrarly to debug to show the whole
// shutdown procedure in the logs even in case of off-logging
Logger::set_level(spdlog::level::debug);
Logger::system().info("Caught signal %d", s);
// we have to trigger ITTI message before terminate
smf_app_inst->trigger_nf_deregistration();
itti_inst->send_terminate_msg(TASK_SMF_APP);
itti_inst->wait_tasks_end();
Logger::system().debug("Freeing Allocated memory...");
if (async_shell_cmd_inst) delete async_shell_cmd_inst;
async_shell_cmd_inst = nullptr;
Logger::system().debug("Async Shell CMD memory done.");
if (smf_api_server_1) {
Logger::system().debug("Stopping HTTP/1 server.");
smf_api_server_1->shutdown();
}
if (smf_api_server_2) {
Logger::system().debug("Stopping HTTP/2 server.");
smf_api_server_2->stop();
}
Logger::system().debug("Freeing Allocated memory...");
if (async_shell_cmd_inst) {
delete async_shell_cmd_inst;
async_shell_cmd_inst = nullptr;
Logger::system().debug("Async Shell CMD memory done.");
}
if (smf_api_server_1) {
delete smf_api_server_1;
smf_api_server_1 = nullptr;
}
if (smf_api_server_2) {
smf_api_server_2->stop();
delete smf_api_server_2;
smf_api_server_2 = nullptr;
}
Logger::system().debug("SMF API Server memory done.");
if (smf_app_inst) delete smf_app_inst;
smf_app_inst = nullptr;
Logger::system().debug("SMF APP memory done.");
if (smf_app_inst) {
delete smf_app_inst;
smf_app_inst = nullptr;
Logger::system().debug("SMF APP memory done.");
}
// itti_inst is used in a lot of code without any nullPtr check
// it has to be deallocated last
if (itti_inst) delete itti_inst;
itti_inst = nullptr;
Logger::system().debug("ITTI memory done.");
if (itti_inst) {
delete itti_inst;
itti_inst = nullptr;
Logger::system().debug("ITTI memory done.");
}
Logger::system().info("Freeing Allocated memory done.");
Logger::system().info("Bye.");
exit(0);
}
//------------------------------------------------------------------------------
Loading