summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/irmd/main.c7
-rw-r--r--src/irmd/registry.c3
2 files changed, 7 insertions, 3 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c
index 58535e27..8503fcfa 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -787,10 +787,10 @@ static int flow_alloc_resp(pid_t n_api,
return -1;
}
- registry_del_api(&irmd->registry, n_api);
-
pthread_mutex_unlock(&rne->state_lock);
+ registry_del_api(&irmd->registry, n_api);
+
pthread_rwlock_unlock(&irmd->reg_lock);
if (!response) {
@@ -1401,10 +1401,11 @@ void * irm_flow_cleaner()
}
pthread_rwlock_unlock(&irmd->flows_lock);
- pthread_rwlock_wrlock(&irmd->reg_lock);
registry_sanitize_apis(&irmd->registry);
+ pthread_rwlock_wrlock(&irmd->reg_lock);
+
list_for_each_safe(pos, n, &irmd->spawned_apis) {
struct spawned_api * api =
list_entry(pos, struct spawned_api, next);
diff --git a/src/irmd/registry.c b/src/irmd/registry.c
index ae8c3b0a..04f60009 100644
--- a/src/irmd/registry.c
+++ b/src/irmd/registry.c
@@ -544,6 +544,8 @@ void registry_del_api(struct list_head * registry,
reg_api_destroy(i);
+ pthread_mutex_lock(&e->state_lock);
+
if (list_empty(&e->reg_apis)) {
if (reg_entry_has_auto_binding(e))
e->state = REG_NAME_AUTO_ACCEPT;
@@ -554,6 +556,7 @@ void registry_del_api(struct list_head * registry,
}
pthread_cond_signal(&e->state_cond);
+ pthread_mutex_unlock(&e->state_lock);
return;
}