Fix quitting
This commit is contained in:
parent
0ec0685714
commit
2b7d455471
|
@ -1176,7 +1176,7 @@ server_context_init (struct server_context *self)
|
||||||
|
|
||||||
str_map_init (&self->config);
|
str_map_init (&self->config);
|
||||||
simple_config_load_defaults (&self->config, g_config_table);
|
simple_config_load_defaults (&self->config, g_config_table);
|
||||||
ev_timer_init (&self->quit_timeout_watcher, on_quit_timeout, 0., 0.);
|
ev_timer_init (&self->quit_timeout_watcher, on_quit_timeout, 3., 0.);
|
||||||
self->quit_timeout_watcher.data = self;
|
self->quit_timeout_watcher.data = self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2260,13 +2260,15 @@ on_quit_timeout (EV_P_ ev_timer *watcher, int revents)
|
||||||
static void
|
static void
|
||||||
initiate_quit (struct server_context *self)
|
initiate_quit (struct server_context *self)
|
||||||
{
|
{
|
||||||
|
self->quitting = true;
|
||||||
close_listeners (self);
|
close_listeners (self);
|
||||||
|
|
||||||
|
// Wait a little while for all clients to clean up, if necessary
|
||||||
LIST_FOR_EACH (struct client, iter, self->clients)
|
LIST_FOR_EACH (struct client, iter, self->clients)
|
||||||
if (iter->vtable->shutdown)
|
if (iter->vtable->shutdown)
|
||||||
iter->vtable->shutdown (iter);
|
iter->vtable->shutdown (iter);
|
||||||
|
ev_timer_start (EV_DEFAULT_ &self->quit_timeout_watcher);
|
||||||
ev_timer_set (&self->quit_timeout_watcher, 3., 0.);
|
try_finish_quit (self);
|
||||||
self->quitting = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue