summaryrefslogtreecommitdiff
path: root/src/irmd
diff options
context:
space:
mode:
Diffstat (limited to 'src/irmd')
-rw-r--r--src/irmd/main.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c
index dfdc7539..db9d7bbd 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -1570,25 +1570,8 @@ static void irm_fini(void)
if (irmd_get_state() != IRMD_NULL)
log_warn("Unsafe destroy.");
- close(irmd.sockfd);
-
- if (unlink(IRM_SOCK_PATH))
- log_dbg("Failed to unlink %s.", IRM_SOCK_PATH);
-
- pthread_rwlock_wrlock(&irmd.flows_lock);
-
- if (irmd.port_ids != NULL)
- bmp_destroy(irmd.port_ids);
-
- list_for_each_safe(p, h, &irmd.irm_flows) {
- struct irm_flow * f = list_entry(p, struct irm_flow, next);
- list_del(&f->next);
- irm_flow_destroy(f);
- }
-
- pthread_rwlock_unlock(&irmd.flows_lock);
-
pthread_rwlock_wrlock(&irmd.reg_lock);
+
/* Clear the lists. */
list_for_each_safe(p, h, &irmd.ipcps) {
struct ipcp_entry * e = list_entry(p, struct ipcp_entry, next);
@@ -1622,6 +1605,25 @@ static void irm_fini(void)
pthread_rwlock_unlock(&irmd.reg_lock);
+ close(irmd.sockfd);
+
+ if (unlink(IRM_SOCK_PATH))
+ log_dbg("Failed to unlink %s.", IRM_SOCK_PATH);
+
+ pthread_rwlock_wrlock(&irmd.flows_lock);
+
+ if (irmd.port_ids != NULL)
+ bmp_destroy(irmd.port_ids);
+
+ list_for_each_safe(p, h, &irmd.irm_flows) {
+ struct irm_flow * f = list_entry(p, struct irm_flow, next);
+ list_del(&f->next);
+ irm_flow_destroy(f);
+ }
+
+ pthread_rwlock_unlock(&irmd.flows_lock);
+
+
if (irmd.rdrb != NULL)
shm_rdrbuff_destroy(irmd.rdrb);