diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-06-19 12:26:13 +0200 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-06-19 12:35:03 +0200 |
commit | a2127552f32b8d9a4c9a988547b4eaa8e1b4a5ca (patch) | |
tree | 95d4fb001b4d247317c67fc4b71959c4c742c02f /src/irmd/main.c | |
parent | bdb4cb8b8f65336d2573476639ba7d79ec924130 (diff) | |
download | ouroboros-a2127552f32b8d9a4c9a988547b4eaa8e1b4a5ca.tar.gz ouroboros-a2127552f32b8d9a4c9a988547b4eaa8e1b4a5ca.zip |
irmd: improved cleanup of flows
If the AP exits, the IRMd will deallocate the flow.
If an IPCP dies, the IRMd will remove the stale resources.
Diffstat (limited to 'src/irmd/main.c')
-rw-r--r-- | src/irmd/main.c | 18 |
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); } |