From 79d9fd60237b16f40eb96fc8ed6eba7fff506636 Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Wed, 4 Oct 2017 09:20:57 +0200 Subject: irmd: Don't destroy flows before IPCPs This allows the IPCPs to call ouroboros_fini() and clean up their buffers and drastically reduce chances of getting an assertion error that some rbuffs are not empty when shutting down the irmd. --- src/irmd/main.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) (limited to 'src') diff --git a/src/irmd/main.c b/src/irmd/main.c index 64e4d459..84c55e93 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -1703,29 +1703,8 @@ void * irm_sanitize(void * o) if (clock_gettime(CLOCK_MONOTONIC, &now) < 0) log_warn("Failed to get time."); - if (irmd_get_state() != IRMD_RUNNING) { - /* Clean up all flows first to kill mainloops */ - pthread_rwlock_wrlock(&irmd.flows_lock); - 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_set_state(f, FLOW_NULL); - clear_irm_flow(f); - irm_flow_destroy(f); - } - pthread_rwlock_unlock(&irmd.flows_lock); - pthread_rwlock_wrlock(&irmd.reg_lock); - /* Clean up api entries as well */ - list_for_each_safe(p, h, &irmd.api_table) { - struct api_entry * e = - list_entry(p, struct api_entry, next); - list_del(&e->next); - api_entry_destroy(e); - } - pthread_rwlock_unlock(&irmd.reg_lock); + if (irmd_get_state() != IRMD_RUNNING) return (void *) 0; - } pthread_rwlock_wrlock(&irmd.reg_lock); -- cgit v1.2.3