summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-08-08 12:53:46 +0000
committerSander Vrijders <sander.vrijders@ugent.be>2017-08-08 12:53:46 +0000
commitc1d7ff1e1bd44e1a38af8a1b498c68f3378fa342 (patch)
treeb42aec0bb1a27025437744d88f0065e907c29716
parent71dda25215e03e20dbe51f6071ea37b3ca3b3cdc (diff)
parentc74f53bd8afcf8fb65c55c7398e36e437b344fb9 (diff)
downloadouroboros-c1d7ff1e1bd44e1a38af8a1b498c68f3378fa342.tar.gz
ouroboros-c1d7ff1e1bd44e1a38af8a1b498c68f3378fa342.zip
Merged in dstaesse/ouroboros/testing-fa (pull request #543)
ipcpd: Fix assignment of fd's in flow allocator
-rw-r--r--src/ipcpd/normal/fa.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ipcpd/normal/fa.c b/src/ipcpd/normal/fa.c
index 704f4f16..5e4dcd5c 100644
--- a/src/ipcpd/normal/fa.c
+++ b/src/ipcpd/normal/fa.c
@@ -164,12 +164,14 @@ static void fa_post_sdu(void * ae,
case FLOW_ALLOC_CODE__FLOW_REPLY:
pthread_rwlock_wrlock(&fa.flows_lock);
+ fa.r_fd[msg->r_fd] = msg->s_fd;
+
ipcp_flow_alloc_reply(msg->r_fd, msg->response);
if (msg->response < 0)
destroy_conn(msg->r_fd);
else
- sdu_sched_add(fa.sdu_sched, fa.r_fd[msg->r_fd]);
+ sdu_sched_add(fa.sdu_sched, msg->r_fd);
pthread_rwlock_unlock(&fa.flows_lock);
@@ -268,7 +270,7 @@ int fa_alloc(int fd,
pthread_rwlock_wrlock(&fa.flows_lock);
- fa.r_fd[fd] = fd;
+ assert(fa.r_fd[fd] == -1);
fa.r_addr[fd] = addr;
pthread_rwlock_unlock(&fa.flows_lock);