diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2021-12-05 11:47:16 +0100 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2021-12-06 17:54:35 +0100 |
commit | 1c28d6844934cdba8b61c022569c3412b3fc8a9b (patch) | |
tree | 747717667fc4dbef0b3ec24bef8925d08b98fb75 | |
parent | bf16a163cc70733653f68b50dabfab42741d4c3f (diff) | |
download | ouroboros-1c28d6844934cdba8b61c022569c3412b3fc8a9b.tar.gz ouroboros-1c28d6844934cdba8b61c022569c3412b3fc8a9b.zip |
ipcpd: Add dt component to regular startup flow
The dt component had init/start commands somewhat outside of the
overall flow of startup of the unicast IPCP. This was probably some
old code and wasn't needed.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
-rw-r--r-- | src/ipcpd/unicast/main.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/src/ipcpd/unicast/main.c b/src/ipcpd/unicast/main.c index 873c6ce3..eafb7f2a 100644 --- a/src/ipcpd/unicast/main.c +++ b/src/ipcpd/unicast/main.c @@ -145,6 +145,11 @@ static int start_components(void) ipcp_set_state(IPCP_OPERATIONAL); + if (dt_start()) { + log_err("Failed to start data transfer."); + goto fail_dt_start; + } + if (fa_start()) { log_err("Failed to start flow allocator."); goto fail_fa_start; @@ -167,6 +172,8 @@ static int start_components(void) fail_enroll_start: fa_stop(); fail_fa_start: + dt_stop(); + fail_dt_start: ipcp_set_state(IPCP_INIT); return -1; } @@ -182,6 +189,8 @@ static void stop_components(void) fa_stop(); + dt_stop(); + ipcp_set_state(IPCP_INIT); } @@ -189,7 +198,6 @@ static int bootstrap_components(void) { if (dir_bootstrap()) { log_err("Failed to bootstrap directory."); - dt_stop(); return -1; } @@ -217,11 +225,6 @@ static int unicast_ipcp_enroll(const char * dst, goto fail_enroll_boot; } - if (dt_start()) { - log_err("Failed to initialize IPCP components."); - goto fail_dt_start; - } - if (start_components()) { log_err("Failed to start components."); goto fail_start_comp; @@ -241,8 +244,6 @@ static int unicast_ipcp_enroll(const char * dst, return 0; fail_start_comp: - dt_stop(); - fail_dt_start: finalize_components(); fail_enroll_boot: connmgr_dealloc(COMPID_ENROLL, &conn); @@ -262,11 +263,6 @@ static int unicast_ipcp_bootstrap(const struct ipcp_config * conf) goto fail_init; } - if (dt_start()) { - log_err("Failed to initialize IPCP components."); - goto fail_dt_start; - }; - if (start_components()) { log_err("Failed to init IPCP components."); goto fail_start; @@ -284,8 +280,6 @@ static int unicast_ipcp_bootstrap(const struct ipcp_config * conf) fail_bootstrap: stop_components(); fail_start: - dt_stop(); - fail_dt_start: finalize_components(); fail_init: return -1; @@ -347,7 +341,6 @@ int main(int argc, ipcp_shutdown(); if (ipcp_get_state() == IPCP_SHUTDOWN) { - dt_stop(); stop_components(); finalize_components(); } |