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.3.0.rc1~1290 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b596cac264eaa0fbd6cd74a279d58accccb7405b;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 b1dc803eb8..92d74777f7 100644 --- a/src/imap/imap-client.c +++ b/src/imap/imap-client.c @@ -448,9 +448,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 3339e1db73..cfbd679dde 100644 --- a/src/imap/imap-client.h +++ b/src/imap/imap-client.h @@ -213,6 +213,7 @@ struct client { bool sync_seen_deletes:1; bool logged_out:1; bool disconnected:1; + bool hibernated:1; bool destroyed:1; bool handling_input:1; bool syncing:1;