summaryrefslogtreecommitdiff
path: root/src/irmd/main.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri@ouroboros.rocks>2024-02-23 13:27:38 +0100
committerSander Vrijders <sander@ouroboros.rocks>2024-02-23 16:41:38 +0100
commitb65e5c1d45c8bfc38b3745cb28ac9074b1c1bdc1 (patch)
tree19aac189a295822ca597b6c923b27becc6249c20 /src/irmd/main.c
parentb7baa89fbaa04ceb3227d4d43089d8e6a5326b65 (diff)
downloadouroboros-b65e5c1d45c8bfc38b3745cb28ac9074b1c1bdc1.tar.gz
ouroboros-b65e5c1d45c8bfc38b3745cb28ac9074b1c1bdc1.zip
irmd: Always use reg_destroy_proc
Destroying a process will now always be done with reg_destroy_proc, regardless of whether it was an IPCP or spawned. This makes it easier to keep the registry consistent and avoid races. Also improves some logs and updates some default settings. Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks> Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/irmd/main.c')
-rw-r--r--src/irmd/main.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c
index 32f41ab2..e2503d0c 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -268,7 +268,7 @@ int create_ipcp(struct ipcp_info * info)
fail_boot:
waitpid(info->pid, &status, 0);
- reg_destroy_ipcp(info->pid);
+ reg_destroy_proc(info->pid);
return -1;
fail_reg_ipcp:
@@ -289,7 +289,7 @@ static int destroy_ipcp(pid_t pid)
goto fail;
}
- if (reg_destroy_ipcp(pid)) {
+ if (reg_destroy_proc(pid)) {
log_err("Failed to remove IPCP from registry.");
goto fail;
}
@@ -741,9 +741,6 @@ static int proc_announce(const struct proc_info * info)
static int proc_exit(pid_t pid)
{
- if (reg_has_ipcp(pid) && reg_destroy_ipcp(pid) < 0)
- log_warn("Failed to remove IPCP %d.", pid);
-
if (reg_destroy_proc(pid) < 0)
log_err("Failed to remove process %d.", pid);
@@ -1023,12 +1020,12 @@ static int flow_alloc(struct flow_info * flow,
uint8_t * s = NULL;
buffer_t hash;
int err;
-
/* piggyback of user data not yet implemented */
assert(data != NULL && data->len == 0 && data->data == NULL);
log_info("Allocating flow for %d to %s.", flow->n_pid, dst);
+
if (flow->qs.cypher_s > 0) {
ssize_t key_len;
@@ -2025,8 +2022,8 @@ static void kill_all_spawned(void)
waitpid(pid, &s, 0);
else {
log_warn("Child process %d died.", pid);
- reg_destroy_spawned(pid);
cleanup_pid(pid);
+ reg_destroy_proc(pid);
}
pid = reg_first_spawned();
}