summaryrefslogtreecommitdiff
path: root/src/ipcpd/common/enroll.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2025-08-16 16:36:10 +0200
committerDimitri Staessens <dimitri@ouroboros.rocks>2025-08-23 10:13:36 +0200
commit4f875bbd387f17ec5d0fd05f3c4346c5da8e048a (patch)
tree6ad92c424b45aa458cdb97b0af23d582b9fda932 /src/ipcpd/common/enroll.c
parent5db139d2dc74f0d4450d3d7f45c3febc4b5dfc1f (diff)
downloadouroboros-4f875bbd387f17ec5d0fd05f3c4346c5da8e048a.tar.gz
ouroboros-4f875bbd387f17ec5d0fd05f3c4346c5da8e048a.zip
ipcpd: Simplify enroll and connmgr startup/shutdown
There's not need to keep these states as they always follow the init/start/stop/fini flow. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Diffstat (limited to 'src/ipcpd/common/enroll.c')
-rw-r--r--src/ipcpd/common/enroll.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/ipcpd/common/enroll.c b/src/ipcpd/common/enroll.c
index ade6db70..8e5384a5 100644
--- a/src/ipcpd/common/enroll.c
+++ b/src/ipcpd/common/enroll.c
@@ -52,15 +52,10 @@
#define ENROLL_WARN_TIME_OFFSET 20
#define ENROLL_BUF_LEN 1024
-enum enroll_state {
- ENROLL_NULL = 0,
- ENROLL_INIT,
- ENROLL_RUNNING
-};
struct {
struct ipcp_config conf;
- enum enroll_state state;
+
pthread_t listener;
} enroll;
@@ -309,16 +304,11 @@ int enroll_init(void)
return -1;
}
- enroll.state = ENROLL_INIT;
-
return 0;
}
void enroll_fini(void)
{
- if (enroll.state == ENROLL_RUNNING)
- pthread_join(enroll.listener, NULL);
-
connmgr_comp_fini(COMPID_ENROLL);
}
@@ -327,13 +317,11 @@ int enroll_start(void)
if (pthread_create(&enroll.listener, NULL, enroll_handle, NULL))
return -1;
- enroll.state = ENROLL_RUNNING;
-
return 0;
}
void enroll_stop(void)
{
- if (enroll.state == ENROLL_RUNNING)
- pthread_cancel(enroll.listener);
+ pthread_cancel(enroll.listener);
+ pthread_join(enroll.listener, NULL);
}