summaryrefslogtreecommitdiff
path: root/src/irmd
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2024-01-07 14:10:36 +0100
committerSander Vrijders <sander@ouroboros.rocks>2024-01-13 10:20:14 +0100
commit763d39ee64e95801ef972ceba74dd6c8c15b1ea7 (patch)
treea8c8a16bc513cd821773dc4b23b12fa9e31a0000 /src/irmd
parent67af6b4edf4fafef6a7bbf620c7b58d42a6e8155 (diff)
downloadouroboros-763d39ee64e95801ef972ceba74dd6c8c15b1ea7.tar.gz
ouroboros-763d39ee64e95801ef972ceba74dd6c8c15b1ea7.zip
irmd: Don't release flow_id before destroying flow
When flow_alloc failed, it was releasing the flow_id, but the flow was needs to be cleaned up by the sanitizer. Bug introduced by ongoing refactor of the flow allocator, which - when done - will properly clean up the flow after a failure and not depend on the sanitizer. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/irmd')
-rw-r--r--src/irmd/main.c3
-rw-r--r--src/irmd/reg/flow.c6
2 files changed, 5 insertions, 4 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c
index 6e7e3d15..20b70a60 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -1757,7 +1757,7 @@ static int flow_alloc(pid_t pid,
fail_alloc:
free(hash);
fail_flow:
- bmp_release(irmd.flow_ids, flow_id);
+ /* Sanitize cleans bmp_release(irmd.flow_ids, flow_id); */
fail_ipcp:
if (qs.cypher_s > 0)
crypt_dh_pkp_destroy(pkp);
@@ -2107,7 +2107,6 @@ void * irm_sanitize(void * o)
&& ts_diff_ms(&f->t0, &now) > IRMD_FLOW_TIMEOUT) {
log_dbg("Pending flow_id %d timed out.",
f->flow_id);
- f->n_pid = -1;
reg_flow_set_state(f, FLOW_DEALLOC_PENDING);
continue;
}
diff --git a/src/irmd/reg/flow.c b/src/irmd/reg/flow.c
index f8be05dd..43d6cb3a 100644
--- a/src/irmd/reg/flow.c
+++ b/src/irmd/reg/flow.c
@@ -66,13 +66,15 @@ struct reg_flow * reg_flow_create(pid_t n_pid,
f->n_rb = shm_rbuff_create(n_pid, flow_id);
if (f->n_rb == NULL) {
- log_err("Could not create ringbuffer for process %d.", n_pid);
+ log_err("Could not create N ringbuffer flow %d, pid %d.",
+ flow_id, n_pid);
goto fail_n_rbuff;
}
f->n_1_rb = shm_rbuff_create(n_1_pid, flow_id);
if (f->n_1_rb == NULL) {
- log_err("Could not create ringbuffer for process %d.", n_1_pid);
+ log_err("Could not create N - 1 ringbuffer flow %d, pid %d.",
+ flow_id, n_1_pid);
goto fail_n_1_rbuff;
}