diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2014-09-20 00:08:23 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2014-09-20 00:08:23 +0200 |
commit | 97bcad8a03de3c40456f07d613c378bc9a07570a (patch) | |
tree | b788e536c41640061a009e724ba5412b66c3f350 | |
parent | 457eff90e3920d27d9d3806d2f44fa40de7af7dc (diff) | |
download | ponymap-97bcad8a03de3c40456f07d613c378bc9a07570a.tar.gz ponymap-97bcad8a03de3c40456f07d613c378bc9a07570a.tar.xz ponymap-97bcad8a03de3c40456f07d613c378bc9a07570a.zip |
Save a syscall per connection
-rw-r--r-- | ponymap.c | 9 | ||||
-rw-r--r-- | utils.c | 5 |
2 files changed, 9 insertions, 5 deletions
@@ -512,13 +512,16 @@ unit_abort (struct unit *u) if (u->service->on_aborted) u->service->on_aborted (u->service_data, u); - poller_timer_reset (&u->timeout_event); - poller_fd_reset (&u->fd_event); - u->transport->cleanup (u); u->service->scan_free (u->service_data); xclose (u->socket_fd); + poller_timer_reset (&u->timeout_event); + + // This way we avoid a syscall with epoll + u->fd_event.fd = -1; + poller_fd_reset (&u->fd_event); + u->transport_data = NULL; u->service_data = NULL; u->socket_fd = -1; @@ -1161,8 +1161,9 @@ poller_remove_at_index (struct poller *self, size_t index) fd->index = -1; poller_remove_from_dispatch (self, fd); - hard_assert (epoll_ctl (self->epoll_fd, - EPOLL_CTL_DEL, fd->fd, (void *) "") != -1); + if (fd->fd != -1) + hard_assert (epoll_ctl (self->epoll_fd, + EPOLL_CTL_DEL, fd->fd, (void *) "") != -1); if (index != --self->len) { |