summaryrefslogtreecommitdiff
path: root/src/irmd
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2016-06-19 12:45:05 +0200
committerSander Vrijders <sander.vrijders@intec.ugent.be>2016-06-19 12:45:05 +0200
commit7d89c65d4de4a460b1a8090aaf32fae379c52af7 (patch)
tree95d4fb001b4d247317c67fc4b71959c4c742c02f /src/irmd
parentbdb4cb8b8f65336d2573476639ba7d79ec924130 (diff)
parenta2127552f32b8d9a4c9a988547b4eaa8e1b4a5ca (diff)
downloadouroboros-7d89c65d4de4a460b1a8090aaf32fae379c52af7.tar.gz
ouroboros-7d89c65d4de4a460b1a8090aaf32fae379c52af7.zip
Merged in dstaesse/ouroboros/be-cleanup-flows (pull request #131)
irmd: improved cleanup of flows
Diffstat (limited to 'src/irmd')
-rw-r--r--src/irmd/main.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c
index 3221edee..bf46a2fd 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -1059,6 +1059,7 @@ static int flow_alloc_res(int port_id)
return 0;
}
if (e->state == FLOW_NULL) {
+ /* don't release the port_id, AP has to call dealloc */
list_del(&e->next);
rw_lock_unlock(&instance->flows_lock);
rw_lock_unlock(&instance->state_lock);
@@ -1369,11 +1370,20 @@ void * irm_flow_cleaner()
pthread_cond_broadcast(&e->res_signal);
}
- if (kill(e->n_pid, 0) < 0 || kill(e->n_1_pid, 0) < 0) {
+
+ if (kill(e->n_pid, 0) < 0) {
bmp_release(instance->port_ids, e->port_id);
+
list_del(&e->next);
- LOG_DBGF("Process died, port_id %d removed.",
- e->port_id);
+ LOG_DBGF("Process %d gone, %d deallocated.",
+ e->n_pid, e->port_id);
+ ipcp_flow_dealloc(e->n_1_pid, e->port_id);
+ free(e);
+ }
+ if (kill(e->n_1_pid, 0) < 0) {
+ list_del(&e->next);
+ LOG_ERR("IPCP %d gone, flow %d removed.",
+ e->n_1_pid, e->port_id);
free(e);
}
@@ -1575,7 +1585,7 @@ static struct irm * irm_create()
shm_du_map_destroy(dum);
LOG_INFO("Stale shm file removed.");
} else {
- LOG_WARN("IRMd already running, exiting.");
+ LOG_INFO("IRMd already running, exiting.");
free(i);
exit(EXIT_SUCCESS);
}