From dac5c9df6d6fc337af1ba8be7f6466b3f2b53259 Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Sat, 16 Jan 2016 04:33:19 +0100
Subject: kike: more cleanup
---
kike.c | 20 ++++++++------------
1 file 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);
--
cgit v1.2.3-70-g09d2