summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/fa.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2017-08-08 06:47:17 -0600
committerDimitri Staessens <dimitri.staessens@ugent.be>2017-08-08 06:47:17 -0600
commitc74f53bd8afcf8fb65c55c7398e36e437b344fb9 (patch)
treeb42aec0bb1a27025437744d88f0065e907c29716 /src/ipcpd/normal/fa.c
parent71dda25215e03e20dbe51f6071ea37b3ca3b3cdc (diff)
downloadouroboros-c74f53bd8afcf8fb65c55c7398e36e437b344fb9.tar.gz
ouroboros-c74f53bd8afcf8fb65c55c7398e36e437b344fb9.zip
ipcpd: Fix assignment of fd's in flow allocator
Diffstat (limited to 'src/ipcpd/normal/fa.c')
-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);