diff options
author | Dimitri Staessens <dimitri.staessens@ugent.be> | 2018-02-24 20:22:15 +0100 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2018-02-24 20:26:48 +0100 |
commit | f58b017f876ad26ed8e16fac86c6bf09445d65c6 (patch) | |
tree | ff5b36fec58a5dc190d8d063cae9ef21841238db | |
parent | 1e081ee37c0313656300c92510c701b3079ec09f (diff) | |
download | ouroboros-0.10.3.tar.gz ouroboros-0.10.3.zip |
irmd: Cleanup flow datastructures on exit0.10.3
The irmd was not cleaning up non-deallocated flows upon exit. This bug
was probably introduced with the introduction of the threadpool
managers. Also fixes a missing rwlock_destroy().
Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be>
Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/irmd/main.c | 17 |
2 files changed, 13 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index aef9c8ed..8421199b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ include(GNUInstallDirs) set(PACKAGE_VERSION_MAJOR 0) set(PACKAGE_VERSION_MINOR 10) -set(PACKAGE_VERSION_PATCH 2) +set(PACKAGE_VERSION_PATCH 3) set(PACKAGE_NAME "${CMAKE_PROJECT_NAME}") set(PACKAGE_DESCRIPTION "The Ouroboros prototype") diff --git a/src/irmd/main.c b/src/irmd/main.c index 64c9efc3..f9cb8fd2 100644 --- a/src/irmd/main.c +++ b/src/irmd/main.c @@ -1555,17 +1555,23 @@ 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); - pthread_rwlock_unlock(&irmd.flows_lock); - - close(irmd.sockfd); + 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); + } - if (unlink(IRM_SOCK_PATH)) - log_dbg("Failed to unlink %s.", IRM_SOCK_PATH); + pthread_rwlock_unlock(&irmd.flows_lock); pthread_rwlock_wrlock(&irmd.reg_lock); /* Clear the lists. */ @@ -1609,6 +1615,7 @@ static void irm_fini(void) pthread_mutex_destroy(&irmd.cmd_lock); pthread_cond_destroy(&irmd.cmd_cond); + pthread_rwlock_destroy(&irmd.flows_lock); pthread_rwlock_destroy(&irmd.reg_lock); pthread_rwlock_destroy(&irmd.state_lock); |