summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2017-05-06 21:35:44 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2017-05-06 21:35:44 +0200
commitc3d62b87996337130f7cdfe6787c92d882196be2 (patch)
tree515e0ca021dc3e5ef3c2b6754653245fd2f92281
parentec842db0fbd3e57b49d0b9a232bd102d54596d0f (diff)
downloadxK-c3d62b87996337130f7cdfe6787c92d882196be2.tar.gz
xK-c3d62b87996337130f7cdfe6787c92d882196be2.tar.xz
xK-c3d62b87996337130f7cdfe6787c92d882196be2.zip
Avoid the "poller_fd::closed" feature
Reliability enhancement for Linux. This feature was created for ponymap, however we don't care about an extra syscall in most places. Doing it right even saves lines.
-rw-r--r--degesch.c7
-rw-r--r--kike.c7
-rw-r--r--zyklonb.c6
3 files changed, 7 insertions, 13 deletions
diff --git a/degesch.c b/degesch.c
index 4a57248..81e893c 100644
--- a/degesch.c
+++ b/degesch.c
@@ -1862,9 +1862,8 @@ server_destroy (struct server *self)
if (self->socket != -1)
{
- xclose (self->socket);
- self->socket_event.closed = true;
poller_fd_reset (&self->socket_event);
+ xclose (self->socket);
}
str_free (&self->read_buffer);
str_free (&self->write_buffer);
@@ -4844,13 +4843,11 @@ irc_destroy_transport (struct server *s)
s->transport->cleanup (s);
s->transport = NULL;
+ poller_fd_reset (&s->socket_event);
xclose (s->socket);
s->socket = -1;
s->state = IRC_DISCONNECTED;
- s->socket_event.closed = true;
- poller_fd_reset (&s->socket_event);
-
str_reset (&s->read_buffer);
str_reset (&s->write_buffer);
}
diff --git a/kike.c b/kike.c
index 4772c29..6073ea0 100644
--- a/kike.c
+++ b/kike.c
@@ -693,9 +693,8 @@ server_context_free (struct server_context *self)
for (size_t i = 0; i < self->n_listen_fds; i++)
{
- xclose (self->listen_fds[i]);
- self->listen_events[i].closed = true;
poller_fd_reset (&self->listen_events[i]);
+ xclose (self->listen_fds[i]);
}
free (self->listen_fds);
free (self->listen_events);
@@ -745,9 +744,8 @@ irc_initiate_quit (struct server_context *ctx)
for (size_t i = 0; i < ctx->n_listen_fds; i++)
{
- xclose (ctx->listen_fds[i]);
- ctx->listen_events[i].closed = true;
poller_fd_reset (&ctx->listen_events[i]);
+ xclose (ctx->listen_fds[i]);
}
ctx->n_listen_fds = 0;
@@ -933,6 +931,7 @@ client_kill (struct client *c, const char *reason)
xclose (c->socket_fd);
c->socket_fd = -1;
+ // We don't fork any children, this is okay
c->socket_event.closed = true;
poller_fd_reset (&c->socket_event);
client_cancel_timers (c);
diff --git a/zyklonb.c b/zyklonb.c
index fd0c80a..d3de92d 100644
--- a/zyklonb.c
+++ b/zyklonb.c
@@ -203,8 +203,8 @@ bot_context_free (struct bot_context *self)
if (self->irc_fd != -1)
{
- xclose (self->irc_fd);
poller_fd_reset (&self->irc_event);
+ xclose (self->irc_fd);
}
if (self->ssl)
SSL_free (self->ssl);
@@ -1585,13 +1585,11 @@ on_irc_disconnected (struct bot_context *ctx)
ctx->ssl_ctx = NULL;
}
+ poller_fd_reset (&ctx->irc_event);
xclose (ctx->irc_fd);
ctx->irc_fd = -1;
ctx->irc_registered = false;
- ctx->irc_event.closed = true;
- poller_fd_reset (&ctx->irc_event);
-
// TODO: inform plugins about the disconnect event
// All of our timers have lost their meaning now