]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dict: Make sure proctitle refresh timeout goes to the main ioloop
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 22 Feb 2022 10:23:33 +0000 (11:23 +0100)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 22 Feb 2022 10:25:27 +0000 (11:25 +0100)
In some situations it could have gone to dict_wait() ioloop, causing
timeout leaks or crashes.

src/dict/main.c

index 3d9185413786e3b95062925111f4122e4b95faad..bcf2bc7b60e28835865ee39fc7e88cef4e9ea3d3 100644 (file)
@@ -25,6 +25,7 @@
 static struct module *modules;
 static struct timeout *to_proctitle;
 static bool proctitle_updated;
+static struct ioloop *main_ioloop;
 
 static void
 add_stats_string(string_t *str, struct stats_dist *stats, const char *name)
@@ -69,7 +70,7 @@ void dict_proctitle_update_later(void)
                return;
 
        if (to_proctitle == NULL)
-               to_proctitle = timeout_add(1000, dict_proctitle_update, NULL);
+               to_proctitle = timeout_add_to(main_ioloop, 1000, dict_proctitle_update, NULL);
        proctitle_updated = TRUE;
 }
 
@@ -167,6 +168,7 @@ int main(int argc, char *argv[])
        main_preinit();
        master_service_set_die_callback(master_service, dict_die);
 
+       main_ioloop = current_ioloop;
        main_init();
        master_service_init_finish(master_service);
        master_service_run(master_service, client_connected);