kike: more cleanup
This commit is contained in:
parent
ced2a57cfc
commit
dac5c9df6d
20
kike.c
20
kike.c
|
@ -1021,9 +1021,8 @@ client_set_timer (struct client *c,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
hard_assert (!c->initialized || c->closing_link);
|
||||||
client_kill (c, NULL);
|
client_kill (c, NULL);
|
||||||
}
|
}
|
||||||
|
@ -1035,9 +1034,8 @@ client_set_kill_timer (struct client *c)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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
|
char *reason = xstrdup_printf
|
||||||
("Ping timeout: >%u seconds", c->ctx->ping_interval);
|
("Ping timeout: >%u seconds", c->ctx->ping_interval);
|
||||||
client_close_link (c, reason);
|
client_close_link (c, reason);
|
||||||
|
@ -1045,9 +1043,8 @@ on_client_timeout_timer (void *user_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
hard_assert (!c->closing_link);
|
||||||
client_send (c, "PING :%s", c->ctx->server_name);
|
client_send (c, "PING :%s", c->ctx->server_name);
|
||||||
client_set_timer (c, &c->timeout_timer, c->ctx->ping_interval);
|
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
|
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);
|
async_cancel (&c->gni->async);
|
||||||
client_finish_connection (c);
|
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;
|
c->socket_event.user_data = c;
|
||||||
|
|
||||||
poller_timer_init (&c->kill_timer, &c->ctx->poller);
|
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;
|
c->kill_timer.user_data = c;
|
||||||
|
|
||||||
poller_timer_init (&c->timeout_timer, &c->ctx->poller);
|
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;
|
c->timeout_timer.user_data = c;
|
||||||
|
|
||||||
poller_timer_init (&c->ping_timer, &c->ctx->poller);
|
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;
|
c->ping_timer.user_data = c;
|
||||||
|
|
||||||
// Resolve the client's hostname first; this is a blocking operation that
|
// 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;
|
c->gni->user_data = c;
|
||||||
|
|
||||||
poller_timer_init (&c->gni_timer, &c->ctx->poller);
|
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;
|
c->gni_timer.user_data = c;
|
||||||
|
|
||||||
poller_timer_set (&c->gni_timer, 5000);
|
poller_timer_set (&c->gni_timer, 5000);
|
||||||
|
|
Loading…
Reference in New Issue