diff options
-rw-r--r-- | src/ipcpd/ipcp.c | 5 | ||||
-rw-r--r-- | src/ipcpd/normal/dir.c | 9 | ||||
-rw-r--r-- | src/ipcpd/normal/main.c | 2 |
3 files changed, 14 insertions, 2 deletions
diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c index e44fafe2..2e4c3fca 100644 --- a/src/ipcpd/ipcp.c +++ b/src/ipcpd/ipcp.c @@ -334,6 +334,9 @@ int ipcp_init(enum ipcp_type type, struct ipcp_ops * ops) int ipcp_boot() { int t; + + ipcp_set_state(IPCP_INIT); + for (t = 0; t < IPCPD_THREADPOOL_SIZE; ++t) { if (pthread_create(&ipcpi.threadpool[t], NULL, ipcp_main_loop, NULL)) { @@ -346,8 +349,6 @@ int ipcp_boot() } } - ipcpi.state = IPCP_INIT; - return 0; } diff --git a/src/ipcpd/normal/dir.c b/src/ipcpd/normal/dir.c index c5bb03dd..d9d15f72 100644 --- a/src/ipcpd/normal/dir.c +++ b/src/ipcpd/normal/dir.c @@ -32,6 +32,7 @@ #include <stdlib.h> #include <string.h> +#include <assert.h> char * create_path(char * name) { @@ -94,6 +95,8 @@ int dir_name_reg(char * name) char * path; uint64_t * addr; + assert(name); + ro_attr_init(&attr); attr.enrol_sync = true; attr.recv_set = ALL_MEMBERS; @@ -107,10 +110,12 @@ int dir_name_reg(char * name) pathname_destroy(path); return -ENOMEM; } + *addr = ribmgr_address(); if (ro_create(path, &attr, (uint8_t *) addr, sizeof(*addr))) { pathname_destroy(path); + free(addr); LOG_ERR("Failed to create RIB object."); return -1; } @@ -118,6 +123,8 @@ int dir_name_reg(char * name) LOG_DBG("Registered %s.", name); pathname_destroy(path); + free(name); + return 0; } @@ -125,6 +132,8 @@ int dir_name_unreg(char * name) { char * path; + assert(name); + path = create_path(name); if (path == NULL) return -ENOMEM; diff --git a/src/ipcpd/normal/main.c b/src/ipcpd/normal/main.c index 8d319894..8db754aa 100644 --- a/src/ipcpd/normal/main.c +++ b/src/ipcpd/normal/main.c @@ -187,6 +187,7 @@ static int normal_ipcp_enroll(char * dst_name) LOG_WARN("Failed to finalize flow manager."); if (ribmgr_fini()) LOG_WARN("Failed to finalize RIB manager."); + ipcp_set_state(IPCP_INIT); pthread_rwlock_unlock(&ipcpi.state_lock); LOG_ERR("Failed to create acceptor thread."); return -1; @@ -269,6 +270,7 @@ static int normal_ipcp_bootstrap(struct dif_config * conf) LOG_WARN("Failed to finalize flow manager."); if (ribmgr_fini()) LOG_WARN("Failed to finalize RIB manager."); + ipcp_set_state(IPCP_INIT); pthread_rwlock_unlock(&ipcpi.state_lock); LOG_ERR("Failed to create acceptor thread."); return -1; |