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 {
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,
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;
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
commands_deinit();
imap_master_clients_deinit();
+ timeout_remove(&to_proctitle);
master_service_deinit(&master_service);
return 0;
}