summaryrefslogtreecommitdiff
path: root/src/ipcpd/ipcp.c
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2017-08-19 17:15:24 +0200
committerdimitri staessens <[email protected]>2017-08-19 17:15:24 +0200
commit1fc486ada3bfc63e72703a494aa180b0a9c6587f (patch)
treed8f3500079718a349b58342d6d162d3cc0ca7e98 /src/ipcpd/ipcp.c
parentc7cb10810c447579cb20a8bc99049baeeb8e2065 (diff)
downloadouroboros-1fc486ada3bfc63e72703a494aa180b0a9c6587f.tar.gz
ouroboros-1fc486ada3bfc63e72703a494aa180b0a9c6587f.zip
ipcpd, irmd: Fix data races
Fixes a data race in the IRMd when IPCPs bail immediately after being created (e.g. due to an error). Fixes a race between the acceptor threads and the threads managed by threadpool manager upon shutdown.
Diffstat (limited to 'src/ipcpd/ipcp.c')
-rw-r--r--src/ipcpd/ipcp.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c
index 7066fb04..368c6eb8 100644
--- a/src/ipcpd/ipcp.c
+++ b/src/ipcpd/ipcp.c
@@ -58,8 +58,6 @@ void ipcp_sig_handler(int sig,
if (ipcp_get_state() == IPCP_OPERATIONAL)
ipcp_set_state(IPCP_SHUTDOWN);
}
-
- tpm_stop();
default:
return;
}
@@ -689,8 +687,9 @@ int ipcp_boot()
void ipcp_shutdown()
{
- tpm_fini();
pthread_join(ipcpi.acceptor, NULL);
+ tpm_stop();
+ tpm_fini();
log_info("IPCP %d shutting down.", getpid());
}