]> 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 <tss@dovecot.fi>
Mon, 10 Jul 2017 13:20:41 +0000 (16:20 +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 b1dc803eb87f77141e1f4a724c35b4a460a4ec4f..92d74777f79288209eaa029b82c1b2455d906cd7 100644 (file)
@@ -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
index 3339e1db736b245b237c3437c415223b56915c2f..cfbd679dde79fb3a22d10a441a0ef8377a2f577a 100644 (file)
@@ -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;