]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
try and defer the exit to give us enough time to signal we're going down
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 5 Jul 2018 02:00:01 +0000 (22:00 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 5 Jul 2018 02:00:01 +0000 (22:00 -0400)
src/modules/rlm_sigtran/event.c

index e124d860fe590620b91fd5bc2e1e61cf367d0843..fbae19a1ca0989c22d7b22bccab8ecc598a1f915 100644 (file)
@@ -481,7 +481,22 @@ static void *sigtran_event_loop(UNUSED void *instance)
        /*
         *      The main event loop.
         */
-       while (!do_exit) osmo_select_main(0);
+       while (true) {
+               osmo_select_main(0);
+               if (do_exit) {
+                       fd_set  readset, writeset, exceptset;
+                       int     high_fd;
+
+                       FD_ZERO(&readset);
+                       FD_ZERO(&writeset);
+                       FD_ZERO(&exceptset);
+
+                       high_fd = osmo_fd_fill_fds(&readset, &writeset, &exceptset);
+                       if (high_fd == 0) break;
+
+                       DEBUG3("osmocom thread - Deferring exit, waiting for fd %i", high_fd);
+               }
+       }
 
        talloc_free(ctx);       /* Also frees ctrl pipe ofd (which closes ctrl_pipe[1]) */