summaryrefslogtreecommitdiff
path: root/src/ipcpd/local/main.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-04-03 14:47:24 +0000
committerSander Vrijders <sander.vrijders@ugent.be>2017-04-03 14:47:24 +0000
commite38e34017b4a7667e11c08e9947e72dfc0b87474 (patch)
treeed204b5d6f653f6ccb3a12a18c53abab0dad7fa9 /src/ipcpd/local/main.c
parent1d4728bcf572c3ebc1632fec9a6751d6644087ce (diff)
parent0f30eaa3d4dd573f9af30a9fd0c5d22bad63c560 (diff)
downloadouroboros-e38e34017b4a7667e11c08e9947e72dfc0b87474.tar.gz
ouroboros-e38e34017b4a7667e11c08e9947e72dfc0b87474.zip
Merged in dstaesse/ouroboros/be-ipcp-req-arr (pull request #456)
ipcpd: Fix some bad locking
Diffstat (limited to 'src/ipcpd/local/main.c')
-rw-r--r--src/ipcpd/local/main.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c
index 38a901c0..718c8d7e 100644
--- a/src/ipcpd/local/main.c
+++ b/src/ipcpd/local/main.c
@@ -229,6 +229,12 @@ static int ipcp_local_flow_alloc(int fd,
assert(dst_name);
+ out_fd = ipcp_flow_req_arr(getpid(), dst_name, cube);
+ if (out_fd < 0) {
+ log_dbg("Flow allocation failed.");
+ return -1;
+ }
+
pthread_rwlock_rdlock(&ipcpi.state_lock);
if (ipcp_get_state() != IPCP_OPERATIONAL) {
@@ -239,14 +245,6 @@ static int ipcp_local_flow_alloc(int fd,
pthread_rwlock_wrlock(&local_data.lock);
- out_fd = ipcp_flow_req_arr(getpid(), dst_name, cube);
- if (out_fd < 0) {
- log_dbg("Flow allocation failed.");
- pthread_rwlock_unlock(&local_data.lock);
- pthread_rwlock_unlock(&ipcpi.state_lock);
- return -1;
- }
-
local_data.in_out[fd] = out_fd;
local_data.in_out[out_fd] = fd;