This will be needed for concurrent accesses.
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;
}
}
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;