]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Process title wrongly shows connections are "corked"
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 29 Oct 2020 11:35:35 +0000 (13:35 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Thu, 3 Dec 2020 13:08:10 +0000 (13:08 +0000)
The flush callback in ostream-file always corks the connection, so the
process title needs to be delayed until it's no longer in that callback.
Add a 0-timeout to update the process title.

src/imap/imap-client.c
src/imap/imap-common.h
src/imap/main.c

index 2c7681d6d64a1f0b08379d093a9e74d4233454e5..07b2a8018b12747e2fee77961c22237f0db81b92 100644 (file)
@@ -1433,7 +1433,7 @@ int client_output(struct client *client)
        client_output_commands(client);
        (void)cmd_sync_delayed(client);
 
-       imap_refresh_proctitle();
+       imap_refresh_proctitle_delayed();
        if (client->output->closed)
                client_destroy(client, NULL);
        else {
index 1e214eb5c495cbf1af914a93873e7b9ddced4e21..1609a8b5bab6f53b28a59ececd9cefd194c1d261 100644 (file)
@@ -31,6 +31,7 @@ imap_client_created_func_t * ATTR_NOWARN_UNUSED_RESULT
 imap_client_created_hook_set(imap_client_created_func_t *new_hook);
 
 void imap_refresh_proctitle(void);
+void imap_refresh_proctitle_delayed(void);
 
 int client_create_from_input(const struct mail_storage_service_input *input,
                             int fd_in, int fd_out, struct client **client_r,
index 90a4cf1d29baaae32f3f1ebe076cb5a52b5ad68b..747b7eb8d7652c131491d90e7813f261badeb288 100644 (file)
@@ -35,6 +35,7 @@
 static bool verbose_proctitle = FALSE;
 static struct mail_storage_service_ctx *storage_service;
 static struct master_login *master_login = NULL;
+static struct timeout *to_proctitle;
 
 imap_client_created_func_t *hook_client_created = NULL;
 bool imap_debug = FALSE;
@@ -52,6 +53,19 @@ imap_client_created_hook_set(imap_client_created_func_t *new_hook)
        return old_hook;
 }
 
+static void imap_refresh_proctitle_callback(void *context ATTR_UNUSED)
+{
+       timeout_remove(&to_proctitle);
+       imap_refresh_proctitle();
+}
+
+void imap_refresh_proctitle_delayed(void)
+{
+       if (to_proctitle == NULL)
+               to_proctitle = timeout_add_short(0,
+                       imap_refresh_proctitle_callback, NULL);
+}
+
 void imap_refresh_proctitle(void)
 {
 #define IMAP_PROCTITLE_PREFERRED_LEN 80
@@ -542,6 +556,7 @@ int main(int argc, char *argv[])
        commands_deinit();
        imap_master_clients_deinit();
 
+       timeout_remove(&to_proctitle);
        master_service_deinit(&master_service);
        return 0;
 }