Move the cleanup code from the signal handlers down to the new emergency handlers for the ue, epc and enb.

master
faluco 3 years ago committed by Andre Puschmann
parent 2c1e9c0c55
commit 9075251627

@ -31,22 +31,13 @@ extern "C" {
#define SRSRAN_TERM_TIMEOUT_S (5)
// static vars required by signal handling
static srslog::sink* log_sink = nullptr;
static std::atomic<bool> running = {true};
void srsran_dft_exit();
static void srsran_signal_handler(int signal)
{
switch (signal) {
case SIGALRM:
fprintf(stderr, "Couldn't stop after %ds. Forcing exit.\n", SRSRAN_TERM_TIMEOUT_S);
srslog::flush();
//: TODO: refactor the sighandler, should not depend on log utilities
if (log_sink) {
log_sink->flush();
}
srsran_dft_exit();
execute_emergency_cleanup_handlers();
raise(SIGKILL);
default:

@ -47,6 +47,7 @@ namespace bpo = boost::program_options;
***********************************************************************/
string config_file;
static bool stdout_ts_enable = false;
static srslog::sink* log_sink = nullptr;
void parse_args(all_args_t* args, int argc, char* argv[])
{
@ -534,9 +535,21 @@ static size_t fixup_log_file_maxsize(int x)
return (x < 0) ? 0 : size_t(x) * 1024u;
}
extern "C" void srsran_dft_exit();
static void emergency_cleanup_handler(void* data)
{
srslog::flush();
if (log_sink) {
log_sink->flush();
}
srsran_dft_exit();
}
int main(int argc, char* argv[])
{
srsran_register_signal_handler();
add_emergency_cleanup_handler(emergency_cleanup_handler, nullptr);
all_args_t args = {};
srsran::metrics_hub<enb_metrics_t> metricshub;
metrics_stdout metrics_screen;

@ -55,6 +55,8 @@ typedef struct {
log_args_t log_args;
} all_args_t;
static srslog::sink* log_sink = nullptr;
/**********************************************************************
* Program arguments processing
***********************************************************************/
@ -353,9 +355,18 @@ std::string get_build_string()
return ss.str();
}
static void emergency_cleanup_handler(void* data)
{
srslog::flush();
if (log_sink) {
log_sink->flush();
}
}
int main(int argc, char* argv[])
{
srsran_register_signal_handler();
add_emergency_cleanup_handler(emergency_cleanup_handler, nullptr);
// print build info
cout << endl << get_build_string() << endl;

@ -47,6 +47,7 @@ namespace bpo = boost::program_options;
static bool do_metrics = false;
static metrics_stdout* metrics_screen = nullptr;
static srslog::sink* log_sink = nullptr;
/**********************************************************************
* Program arguments processing
@ -656,9 +657,20 @@ static size_t fixup_log_file_maxsize(int x)
return (x < 0) ? 0 : size_t(x) * 1024u;
}
extern "C" void srsran_dft_exit();
static void emergency_cleanup_handler(void* data)
{
srslog::flush();
if (log_sink) {
log_sink->flush();
}
srsran_dft_exit();
}
int main(int argc, char* argv[])
{
srsran_register_signal_handler();
add_emergency_cleanup_handler(emergency_cleanup_handler, nullptr);
srsran_debug_handle_crash(argc, argv);
all_args_t args = {};

Loading…
Cancel
Save