Vadim Yanitskiy has uploaded this change for review. ( 
https://gerrit.osmocom.org/10222


Change subject: hlr.c: move deinitialization code from SIGINT handler
......................................................................

hlr.c: move deinitialization code from SIGINT handler

There were a few lines of dead code below the osmo_select_main()
loop, while the actual deinitialization code was a part of SIGINT
handler. Let's reanimate this dead zone by moving the code there
and introducing a global 'loop-breaker' variable.

Change-Id: I0e2d673b420193e2bdc1a92377aca542f3a19229
---
M src/hlr.c
1 file changed, 7 insertions(+), 9 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-hlr refs/changes/22/10222/1

diff --git a/src/hlr.c b/src/hlr.c
index 643dfff..7fdb27e 100644
--- a/src/hlr.c
+++ b/src/hlr.c
@@ -44,6 +44,7 @@
 #include "hlr_vty.h"

 static struct hlr *g_hlr;
+static int quit = 0;

 /* Trigger 'Insert Subscriber Data' messages to all connected GSUP clients.
  *
@@ -523,11 +524,7 @@
        switch (signal) {
        case SIGINT:
                LOGP(DMAIN, LOGL_NOTICE, "Terminating due to SIGINT\n");
-               osmo_gsup_server_destroy(g_hlr->gs);
-               db_close(g_hlr->dbc);
-               log_fini();
-               talloc_report_full(hlr_ctx, stderr);
-               exit(0);
+               quit++;
                break;
        case SIGUSR1:
                LOGP(DMAIN, LOGL_DEBUG, "Talloc Report due to SIGUSR1\n");
@@ -621,13 +618,14 @@
                }
        }

-       while (1) {
+       while (!quit)
                osmo_select_main(0);
-       }

+       osmo_gsup_server_destroy(g_hlr->gs);
        db_close(g_hlr->dbc);
-
        log_fini();

-       exit(0);
+       talloc_report_full(hlr_ctx, stderr);
+
+       return 0;
 }

--
To view, visit https://gerrit.osmocom.org/10222
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0e2d673b420193e2bdc1a92377aca542f3a19229
Gerrit-Change-Number: 10222
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <[email protected]>

Reply via email to