diff options
author | Sander Vrijders <[email protected]> | 2017-03-21 15:23:50 +0000 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2017-03-21 15:23:50 +0000 |
commit | 1fbb83707e3a43847d36896c6cbc045a91af5ecf (patch) | |
tree | 4e92ef79db3f1352982716ff6f37f8a7dd3397eb /src/ipcpd/normal/main.c | |
parent | fef50c3db0e02f0052f1759d508045c44fc4146e (diff) | |
parent | 933a7b93a679b994214c49540d891a901c7d5458 (diff) | |
download | ouroboros-1fbb83707e3a43847d36896c6cbc045a91af5ecf.tar.gz ouroboros-1fbb83707e3a43847d36896c6cbc045a91af5ecf.zip |
Merged in sandervrijders/ouroboros/be-fmgr (pull request #406)
ipcpd: normal: Split fmgr init into init and start
Diffstat (limited to 'src/ipcpd/normal/main.c')
-rw-r--r-- | src/ipcpd/normal/main.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c index 398d6ee3..7acf3046 100644 --- a/src/ipcpd/normal/main.c +++ b/src/ipcpd/normal/main.c @@ -143,25 +143,27 @@ static int boot_components(void) log_dbg("Ribmgr started."); - if (fmgr_init()) { + if (frct_init()) { dir_fini(); ribmgr_fini(); addr_auth_fini(); - log_err("Failed to start flow manager."); + log_err("Failed to initialize FRCT."); return -1; } - if (frct_init()) { - fmgr_fini(); + if (fmgr_start()) { + frct_fini(); dir_fini(); ribmgr_fini(); addr_auth_fini(); - log_err("Failed to initialize FRCT."); + log_err("Failed to start flow manager."); return -1; } + if (enroll_start()) { - fmgr_fini(); + fmgr_stop(); + frct_fini(); dir_fini(); ribmgr_fini(); addr_auth_fini(); @@ -174,8 +176,8 @@ static int boot_components(void) if (connmgr_start()) { ipcp_set_state(IPCP_INIT); enroll_stop(); + fmgr_stop(); frct_fini(); - fmgr_fini(); dir_fini(); ribmgr_fini(); addr_auth_fini(); @@ -194,7 +196,7 @@ void shutdown_components(void) frct_fini(); - fmgr_fini(); + fmgr_stop(); dir_fini(); @@ -418,7 +420,6 @@ int main(int argc, exit(EXIT_FAILURE); } - if (connmgr_init()) { log_err("Failed to initialize connection manager."); ipcp_create_r(getpid(), -1); @@ -438,11 +439,23 @@ int main(int argc, exit(EXIT_FAILURE); } + if (fmgr_init()) { + log_err("Failed to initialize flow manager component."); + ipcp_create_r(getpid(), -1); + enroll_fini(); + connmgr_fini(); + rib_fini(); + irm_unbind_api(getpid(), ipcpi.name); + ipcp_fini(); + exit(EXIT_FAILURE); + } + pthread_sigmask(SIG_BLOCK, &sigset, NULL); if (ipcp_boot() < 0) { log_err("Failed to boot IPCP."); ipcp_create_r(getpid(), -1); + fmgr_fini(); enroll_fini(); connmgr_fini(); rib_fini(); @@ -457,6 +470,7 @@ int main(int argc, log_err("Failed to notify IRMd we are initialized."); ipcp_set_state(IPCP_NULL); ipcp_shutdown(); + fmgr_fini(); enroll_fini(); connmgr_fini(); rib_fini(); @@ -470,12 +484,14 @@ int main(int argc, if (ipcp_get_state() == IPCP_SHUTDOWN) shutdown_components(); - rib_fini(); + fmgr_fini(); enroll_fini(); connmgr_fini(); + rib_fini(); + irm_unbind_api(getpid(), ipcpi.name); ipcp_fini(); |