From c74f53bd8afcf8fb65c55c7398e36e437b344fb9 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Tue, 8 Aug 2017 06:47:17 -0600 Subject: ipcpd: Fix assignment of fd's in flow allocator --- src/ipcpd/normal/fa.c | 6 ++++-- 1 file 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); -- cgit v1.2.3