From: Timo Sirainen Date: Mon, 10 Jul 2017 10:56:49 +0000 (+0300) Subject: imap: Don't do autoexpunging when IMAP client is hibernated X-Git-Tag: 2.2.32.rc1~120 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f49b532f2556085d25b1c546cd6826aab6a1f8c8;p=thirdparty%2Fdovecot%2Fcore.git imap: Don't do autoexpunging when IMAP client is hibernated --- diff --git a/src/imap/imap-client-hibernate.c b/src/imap/imap-client-hibernate.c index f2b235559d..492895e9b5 100644 --- a/src/imap/imap-client-hibernate.c +++ b/src/imap/imap-client-hibernate.c @@ -239,6 +239,7 @@ bool imap_client_hibernate(struct client **_client) /* hide the disconnect log message, because the client didn't actually log out */ client->disconnected = TRUE; + client->hibernated = TRUE; client_destroy(client, NULL); *_client = NULL; } diff --git a/src/imap/imap-client.c b/src/imap/imap-client.c index f9d998c445..c22a12f55e 100644 --- a/src/imap/imap-client.c +++ b/src/imap/imap-client.c @@ -455,9 +455,14 @@ static void client_default_destroy(struct client *client, const char *reason) before it starts, and refresh proctitle so it's clear that it's doing autoexpunging. We've also sent DISCONNECT to anvil already, because this is background work and shouldn't really be counted - as an active IMAP session for the user. */ + as an active IMAP session for the user. + + Don't autoexpunge if the client is hibernated - it shouldn't be any + different from the non-hibernating IDLE case. For frequent + hibernations it could also be doing unnecessarily much work. */ imap_refresh_proctitle(); - mail_user_autoexpunge(client->user); + if (!client->hibernated) + mail_user_autoexpunge(client->user); mail_user_unref(&client->user); /* free the i/ostreams after mail_user_unref(), which could trigger diff --git a/src/imap/imap-client.h b/src/imap/imap-client.h index 5cde0d6e6e..29a6828c40 100644 --- a/src/imap/imap-client.h +++ b/src/imap/imap-client.h @@ -213,6 +213,7 @@ struct client { unsigned int sync_seen_deletes:1; unsigned int logged_out:1; unsigned int disconnected:1; + unsigned int hibernated:1; unsigned int destroyed:1; unsigned int handling_input:1; unsigned int syncing:1;