From: Christopher Faulet Date: Tue, 5 Sep 2017 07:51:57 +0000 (+0200) Subject: MINOR: fd: Set owner and iocb field before inserting a new fd in the fdtab X-Git-Tag: v1.8-dev3~132 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=576c5aa25c871acadc1e2dbdc0121aacd0035a87;p=thirdparty%2Fhaproxy.git MINOR: fd: Set owner and iocb field before inserting a new fd in the fdtab This will be needed for concurrent accesses. --- 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;