]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Don't do autoexpunging when IMAP client is hibernated
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 10 Jul 2017 10:56:49 +0000 (13:56 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 12 Jul 2017 21:21:48 +0000 (00:21 +0300)
src/imap/imap-client-hibernate.c
src/imap/imap-client.c
src/imap/imap-client.h

index f2b235559d48ebfd8b7a47c4e32a2201fff6fcbb..492895e9b507a03a4e90f334eb7e7be64d73fbf2 100644 (file)
@@ -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;
        }
index f9d998c4450d0ad78692e4d8e29052b310f06cf7..c22a12f55edca3745864a650f6a6db78e4cabd68 100644 (file)
@@ -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
index 5cde0d6e6ee6ac93277c3d4e0cb702aa4b52422b..29a6828c40981787ee45d2a623705fa07daf5404 100644 (file)
@@ -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;