summaryrefslogtreecommitdiff
path: root/src/ipcpd/local
diff options
context:
space:
mode:
authorSander Vrijders <sander.vrijders@ugent.be>2017-04-05 12:41:49 +0000
committerdimitri staessens <dimitri.staessens@ugent.be>2017-04-05 12:41:49 +0000
commit901a97a2a51ece0fd9991797b9764f60268962b3 (patch)
treee60083545da6ce0dc5fdacd06610d907b90c5aee /src/ipcpd/local
parent10195b445b6788c60dfd851e3095fdfcb903e574 (diff)
parentc5b092665c219c679ede91b3dc816c61f2f9dabe (diff)
downloadouroboros-901a97a2a51ece0fd9991797b9764f60268962b3.tar.gz
ouroboros-901a97a2a51ece0fd9991797b9764f60268962b3.zip
Merged in sandervrijders/ouroboros/be-fix-llc (pull request #462)
Be fix llc
Diffstat (limited to 'src/ipcpd/local')
-rw-r--r--src/ipcpd/local/main.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/ipcpd/local/main.c b/src/ipcpd/local/main.c
index 3e5c4803..88d0912e 100644
--- a/src/ipcpd/local/main.c
+++ b/src/ipcpd/local/main.c
@@ -223,33 +223,22 @@ static int ipcp_local_flow_alloc(int fd,
return -1; /* -ENOTENROLLED */
}
- /*
- * This function needs to return completely before
- * flow_resp. Taking the wrlock on the data is the simplest
- * way to achieve this.
- */
-
- pthread_rwlock_wrlock(&local_data.lock);
+ pthread_mutex_lock(&ipcpi.alloc_lock);
out_fd = ipcp_flow_req_arr(getpid(), dst_name, cube);
if (out_fd < 0) {
- pthread_rwlock_unlock(&local_data.lock);
+ pthread_mutex_unlock(&ipcpi.alloc_lock);
log_dbg("Flow allocation failed: %d", out_fd);
return -1;
}
- /*
- * The idea of the port_wait_assign in dev.c was to do the
- * above synchronisation. But if the lock is not taken, the
- * resp() function may be called before a lock would be taken
- * here. This shim will be deprecated, but ideally the sync is
- * fixed in ipcp.c.
- */
+ pthread_rwlock_wrlock(&local_data.lock);
local_data.in_out[fd] = out_fd;
local_data.in_out[out_fd] = fd;
pthread_rwlock_unlock(&local_data.lock);
+ pthread_mutex_unlock(&ipcpi.alloc_lock);
flow_set_add(local_data.flows, fd);