MINOR: fd: Set owner and iocb field before inserting a new fd in the fdtab

This will be needed for concurrent accesses.
This commit is contained in:
Christopher Faulet 2017-09-05 09:51:57 +02:00 committed by Willy Tarreau
parent d531f88622
commit 576c5aa25c
2 changed files with 3 additions and 3 deletions

View File

@ -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;
}
}

View File

@ -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;