kike: more cleanup

This commit is contained in:
Přemysl Eric Janouch 2016-01-16 04:33:19 +01:00
parent ced2a57cfc
commit dac5c9df6d
1 changed files with 8 additions and 12 deletions

20
kike.c
View File

@ -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);