Fix the epoll poller
Setting the fd to -1 broke poller_remove_from_dispatch().
This commit is contained in:
parent
89edba14f0
commit
21cab71e75
|
@ -534,7 +534,7 @@ unit_abort (struct unit *u)
|
||||||
poller_timer_reset (&u->timeout_event);
|
poller_timer_reset (&u->timeout_event);
|
||||||
|
|
||||||
// This way we avoid a syscall with epoll
|
// This way we avoid a syscall with epoll
|
||||||
u->fd_event.fd = -1;
|
u->fd_event.closed = true;
|
||||||
poller_fd_reset (&u->fd_event);
|
poller_fd_reset (&u->fd_event);
|
||||||
|
|
||||||
u->transport_data = NULL;
|
u->transport_data = NULL;
|
||||||
|
|
3
utils.c
3
utils.c
|
@ -873,6 +873,7 @@ struct poller_fd
|
||||||
|
|
||||||
int fd; ///< Our file descriptor
|
int fd; ///< Our file descriptor
|
||||||
short events; ///< The poll() events we registered for
|
short events; ///< The poll() events we registered for
|
||||||
|
bool closed; ///< Whether fd has been closed already
|
||||||
|
|
||||||
poller_fd_fn dispatcher; ///< Event dispatcher
|
poller_fd_fn dispatcher; ///< Event dispatcher
|
||||||
void *user_data; ///< User data
|
void *user_data; ///< User data
|
||||||
|
@ -1194,7 +1195,7 @@ poller_remove_at_index (struct poller *self, size_t index)
|
||||||
fd->index = -1;
|
fd->index = -1;
|
||||||
|
|
||||||
poller_remove_from_dispatch (self, fd);
|
poller_remove_from_dispatch (self, fd);
|
||||||
if (fd->fd != -1)
|
if (!fd->closed)
|
||||||
hard_assert (epoll_ctl (self->epoll_fd,
|
hard_assert (epoll_ctl (self->epoll_fd,
|
||||||
EPOLL_CTL_DEL, fd->fd, (void *) "") != -1);
|
EPOLL_CTL_DEL, fd->fd, (void *) "") != -1);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue