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>
---
src/ipcpd/unicast/main.c | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/src/ipcpd/unicast/main.c b/src/ipcpd/unicast/main.c
index 873c6ce..e6a37fe 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;
@@ -168,6 +173,7 @@ static int start_components(void)
fa_stop();
fail_fa_start:
ipcp_set_state(IPCP_INIT);
+ fail_dt_start:
return -1;
}
@@ -182,6 +188,8 @@ static void stop_components(void)
fa_stop();
+ dt_stop();
+
ipcp_set_state(IPCP_INIT);
}
@@ -189,7 +197,6 @@ static int bootstrap_components(void)
{
if (dir_bootstrap()) {
log_err("Failed to bootstrap directory.");
- dt_stop();
return -1;
}
@@ -217,11 +224,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 +243,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 +262,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 +279,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 +340,6 @@ int main(int argc,
ipcp_shutdown();
if (ipcp_get_state() == IPCP_SHUTDOWN) {
- dt_stop();
stop_components();
finalize_components();
}
--
2.34.1