File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -810,6 +810,23 @@ do { \
810810 */
811811 if (unlang_global_init () < 0 ) EXIT_WITH_FAILURE ;
812812
813+ /*
814+ * Initialize the global event loop which handles things like
815+ * systemd.
816+ *
817+ * This has to be done post-fork in case we're using kqueue, where the
818+ * queue isn't inherited by the child process.
819+ *
820+ * Done before `server_init` so that module instantiate callbacks can
821+ * register fds / timers against `main_loop_event_list()` directly.
822+ * `main_loop_init` has no dependencies on module or virtual server
823+ * state, so this reordering is safe.
824+ */
825+ if (main_loop_init () < 0 ) {
826+ PERROR ("Failed initialising main event loop" );
827+ EXIT_WITH_FAILURE ;
828+ }
829+
813830 if (server_init (config -> root_cs , config -> confdir , fr_dict_unconst (fr_dict_internal ())) < 0 ) EXIT_WITH_FAILURE ;
814831
815832 /*
@@ -828,18 +845,6 @@ do { \
828845 EXIT_WITH_FAILURE ;
829846 }
830847
831- /*
832- * Initialize the global event loop which handles things like
833- * systemd.
834- *
835- * This has to be done post-fork in case we're using kqueue, where the
836- * queue isn't inherited by the child process.
837- */
838- if (main_loop_init () < 0 ) {
839- PERROR ("Failed initialising main event loop" );
840- EXIT_WITH_FAILURE ;
841- }
842-
843848 /*
844849 * Start the network / worker threads.
845850 */
You can’t perform that action at this time.
0 commit comments