summaryrefslogtreecommitdiff
path: root/src/irmd
diff options
context:
space:
mode:
Diffstat (limited to 'src/irmd')
-rw-r--r--src/irmd/main.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c
index 27f57077..d0ba969f 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -1379,6 +1379,8 @@ void * irm_flow_cleaner()
struct timespec now;
struct list_head * pos = NULL;
struct list_head * n = NULL;
+ struct list_head * h = NULL;
+ struct list_head * t = NULL;
struct timespec timeout = {IRMD_CLEANUP_TIMER / BILLION,
IRMD_CLEANUP_TIMER % BILLION};
@@ -1444,10 +1446,10 @@ void * irm_flow_cleaner()
pthread_rwlock_unlock(&irmd->flows_lock);
- registry_sanitize_apis(&irmd->registry);
-
pthread_rwlock_wrlock(&irmd->reg_lock);
+ registry_sanitize_apis(&irmd->registry);
+
list_for_each_safe(pos, n, &irmd->spawned_apis) {
struct spawned_api * api =
list_entry(pos, struct spawned_api, next);
@@ -1457,6 +1459,17 @@ void * irm_flow_cleaner()
LOG_INFO("Spawned process %d terminated "
"with exit status %d.",
api->api, status);
+
+ list_for_each_safe(h, t, &irmd->ipcps) {
+ struct ipcp_entry * e =
+ list_entry(h, struct ipcp_entry,
+ next);
+ if (e->api == api->api) {
+ list_del(&e->next);
+ ipcp_entry_destroy(e);
+ }
+ }
+
list_del(&api->next);
free(api);
}