summaryrefslogtreecommitdiff
path: root/src/ipcpd/ipcp.c
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@intec.ugent.be>2017-01-04 11:35:18 +0100
committerSander Vrijders <sander.vrijders@intec.ugent.be>2017-01-04 11:35:18 +0100
commita241f53af601a8b9462b600a20381228f0f8e2e0 (patch)
tree3c8f23666da58259f67bc253314fa1e6952111e6 /src/ipcpd/ipcp.c
parent004b586fd6b381fd1292aa276342163123be560a (diff)
parentf3fbf2c6093b293f995c4d784509577695e052b1 (diff)
downloadouroboros-a241f53af601a8b9462b600a20381228f0f8e2e0.tar.gz
ouroboros-a241f53af601a8b9462b600a20381228f0f8e2e0.zip
Merged in dstaesse/ouroboros/be-normal-refactor (pull request #331)
ipcpd: Refactor normal ipcp, initial commit
Diffstat (limited to 'src/ipcpd/ipcp.c')
-rw-r--r--src/ipcpd/ipcp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ipcpd/ipcp.c b/src/ipcpd/ipcp.c
index a2dc9e8f..c47f1181 100644
--- a/src/ipcpd/ipcp.c
+++ b/src/ipcpd/ipcp.c
@@ -1,5 +1,5 @@
/*
- * Ouroboros - Copyright (C) 2016
+ * Ouroboros - Copyright (C) 2016 - 2017
*
* IPC process main loop
*
@@ -65,6 +65,7 @@ static void * ipcp_main_loop(void * o)
int fd = -1;
pthread_rwlock_rdlock(&ipcpi.state_lock);
+
if (ipcp_get_state() == IPCP_SHUTDOWN
|| ipcp_get_state() == IPCP_NULL) {
pthread_rwlock_unlock(&ipcpi.state_lock);
@@ -389,7 +390,9 @@ int ipcp_wait_state(enum ipcp_state state,
pthread_mutex_lock(&ipcpi.state_mtx);
- while (ipcpi.state != state && ipcpi.state != IPCP_SHUTDOWN) {
+ while (ipcpi.state != state
+ && ipcpi.state != IPCP_SHUTDOWN
+ && ipcpi.state != IPCP_NULL) {
if (timeout == NULL)
ret = -pthread_cond_wait(&ipcpi.state_cond,
&ipcpi.state_mtx);