summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2016-08-10 11:10:02 +0200
committerSander Vrijders <sander.vrijders@intec.ugent.be>2016-08-10 11:10:02 +0200
commit822dfbd3c41e9815361d1199afc9775b091d7456 (patch)
tree3db78aca69a38d7cbb9a53724cb72fcf5456d556
parent7287e5649b122ec134f58e157e7908e2285dfa42 (diff)
downloadouroboros-822dfbd3c41e9815361d1199afc9775b091d7456.tar.gz
ouroboros-822dfbd3c41e9815361d1199afc9775b091d7456.zip
irmd: Remove IPCP from list upon error
If an IPCP crashes (due to a segfault for instance), it is removed from the spawned apis list. However, if it was an IPCP it should also be removed from the IPCPs list, since else on shutdown, the irmd will try to destroy the IPCP that crashed.
-rw-r--r--src/irmd/main.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c
index 8503fcfa..35208909 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -1337,6 +1337,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};
@@ -1415,6 +1417,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);
}