aboutsummaryrefslogtreecommitdiff
path: root/kike.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2016-01-16 04:33:19 +0100
committerPřemysl Janouch <p.janouch@gmail.com>2016-01-16 06:30:08 +0100
commitdac5c9df6d6fc337af1ba8be7f6466b3f2b53259 (patch)
tree976a5b2eda22390f81b5580a7140465754dbf51f /kike.c
parentced2a57cfcf8f1ed45f93bc74a876a5eb2e9d0b3 (diff)
downloadxK-dac5c9df6d6fc337af1ba8be7f6466b3f2b53259.tar.gz
xK-dac5c9df6d6fc337af1ba8be7f6466b3f2b53259.tar.xz
xK-dac5c9df6d6fc337af1ba8be7f6466b3f2b53259.zip
kike: more cleanup
Diffstat (limited to 'kike.c')
-rw-r--r--kike.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/kike.c b/kike.c
index 9c349c0..b07aebf 100644
--- a/kike.c
+++ b/kike.c
@@ -1021,9 +1021,8 @@ client_set_timer (struct client *c,
}
static void
-on_client_kill_timer (void *user_data)
+on_client_kill_timer (struct client *c)
{
- struct client *c = user_data;
hard_assert (!c->initialized || c->closing_link);
client_kill (c, NULL);
}
@@ -1035,9 +1034,8 @@ client_set_kill_timer (struct client *c)
}
static void
-on_client_timeout_timer (void *user_data)
+on_client_timeout_timer (struct client *c)
{
- struct client *c = user_data;
char *reason = xstrdup_printf
("Ping timeout: >%u seconds", c->ctx->ping_interval);
client_close_link (c, reason);
@@ -1045,9 +1043,8 @@ on_client_timeout_timer (void *user_data)
}
static void
-on_client_ping_timer (void *user_data)
+on_client_ping_timer (struct client *c)
{
- struct client *c = user_data;
hard_assert (!c->closing_link);
client_send (c, "PING :%s", c->ctx->server_name);
client_set_timer (c, &c->timeout_timer, c->ctx->ping_interval);
@@ -3409,9 +3406,8 @@ on_client_gni_resolved (int result, char *host, char *port, void *user_data)
}
static void
-on_client_gni_timer (void *user_data)
+on_client_gni_timer (struct client *c)
{
- struct client *c = user_data;
async_cancel (&c->gni->async);
client_finish_connection (c);
}
@@ -3477,15 +3473,15 @@ irc_try_fetch_client (struct server_context *ctx, int listen_fd)
c->socket_event.user_data = c;
poller_timer_init (&c->kill_timer, &c->ctx->poller);
- c->kill_timer.dispatcher = on_client_kill_timer;
+ c->kill_timer.dispatcher = (poller_timer_fn) on_client_kill_timer;
c->kill_timer.user_data = c;
poller_timer_init (&c->timeout_timer, &c->ctx->poller);
- c->timeout_timer.dispatcher = on_client_timeout_timer;
+ c->timeout_timer.dispatcher = (poller_timer_fn) on_client_timeout_timer;
c->timeout_timer.user_data = c;
poller_timer_init (&c->ping_timer, &c->ctx->poller);
- c->ping_timer.dispatcher = on_client_ping_timer;
+ c->ping_timer.dispatcher = (poller_timer_fn) on_client_ping_timer;
c->ping_timer.user_data = c;
// Resolve the client's hostname first; this is a blocking operation that
@@ -3497,7 +3493,7 @@ irc_try_fetch_client (struct server_context *ctx, int listen_fd)
c->gni->user_data = c;
poller_timer_init (&c->gni_timer, &c->ctx->poller);
- c->gni_timer.dispatcher = on_client_gni_timer;
+ c->gni_timer.dispatcher = (poller_timer_fn) on_client_gni_timer;
c->gni_timer.user_data = c;
poller_timer_set (&c->gni_timer, 5000);