From 9766166aa944fc6d8754f1b2c5262d7044690c50 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Wed, 28 Dec 2016 14:46:16 +0100 Subject: ipcpd: Wait for operational state to start fmgr The main thread will wait for the IPCP_OPERATIONAL state before starting the fmgr main thread by calling fmgr_init(), instead of the fmgr itself waiting for that state. --- src/ipcpd/normal/main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/ipcpd/normal/main.c') diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c index 4eb708b4..34ba52da 100644 --- a/src/ipcpd/normal/main.c +++ b/src/ipcpd/normal/main.c @@ -215,22 +215,24 @@ int main(int argc, char * argv[]) pthread_sigmask(SIG_UNBLOCK, &sigset, NULL); - if (fmgr_init()) { + if (ribmgr_init()) { + fmgr_fini(); ipcp_fini(); close_logfile(); exit(EXIT_FAILURE); } - if (ribmgr_init()) { + if (ipcp_create_r(getpid())) { + LOG_ERR("Failed to notify IRMd we are initialized."); fmgr_fini(); ipcp_fini(); close_logfile(); exit(EXIT_FAILURE); } - if (ipcp_create_r(getpid())) { - LOG_ERR("Failed to notify IRMd we are initialized."); - fmgr_fini(); + ipcp_wait_state(IPCP_OPERATIONAL, NULL); + + if (fmgr_init()) { ipcp_fini(); close_logfile(); exit(EXIT_FAILURE); -- cgit v1.2.3