osmo-msc main: use osmo_select_shutdown()

Change-Id: I75f4637c051ed44628e65dab1bdbbf28dcc9626f
This commit is contained in:
Neels Hofmeyr 2021-06-22 00:17:53 +02:00
parent 435f67f43c
commit 07c8b7cb2e
1 changed files with 15 additions and 5 deletions

View File

@ -776,14 +776,24 @@ TODO: we probably want some of the _net_ ctrl commands from bsc_base_ctrl_cmds_i
}
}
while (!quit) {
do {
log_reset_context();
osmo_select_main_ctx(0);
}
/* If the user hits Ctrl-C the third time, just terminate immediately. */
if (quit >= 3)
break;
/* Has SIGTERM been received (and not yet been handled)? */
if (quit && !osmo_select_shutdown_requested()) {
msc_network_shutdown(msc_network);
osmo_signal_dispatch(SS_L_GLOBAL, S_L_GLOBAL_SHUTDOWN, NULL);
sleep(3);
/* Request write-only mode in osmo_select_main_ctx() */
osmo_select_shutdown_request();
/* continue the main select loop until all write queues are serviced. */
}
} while (!osmo_select_shutdown_done());
log_fini();