From 576c5aa25c871acadc1e2dbdc0121aacd0035a87 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 5 Sep 2017 09:51:57 +0200 Subject: [PATCH] MINOR: fd: Set owner and iocb field before inserting a new fd in the fdtab This will be needed for concurrent accesses. --- include/proto/connection.h | 4 ++-- src/dns.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/proto/connection.h b/include/proto/connection.h index 9be862b40c..2ec2ef8b11 100644 --- a/include/proto/connection.h +++ b/include/proto/connection.h @@ -108,12 +108,12 @@ static inline void conn_ctrl_init(struct connection *conn) if (!conn_ctrl_ready(conn)) { int fd = conn->handle.fd; + fdtab[fd].owner = conn; + fdtab[fd].iocb = conn_fd_handler; fd_insert(fd); /* mark the fd as ready so as not to needlessly poll at the beginning */ fd_may_recv(fd); fd_may_send(fd); - fdtab[fd].owner = conn; - fdtab[fd].iocb = conn_fd_handler; conn->flags |= CO_FL_CTRL_READY; } } diff --git a/src/dns.c b/src/dns.c index 2cf1ec954a..d96c91d565 100644 --- a/src/dns.c +++ b/src/dns.c @@ -1721,9 +1721,9 @@ int dns_init_resolvers(int close_socket) fcntl(fd, F_SETFL, O_NONBLOCK); /* add the fd in the fd list and update its parameters */ - fd_insert(fd); fdtab[fd].owner = dgram; fdtab[fd].iocb = dgram_fd_handler; + fd_insert(fd); fd_want_recv(fd); dgram->t.sock.fd = fd;