]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imapc: If we get disconnected during SELECT/EXAMINE, retry it once.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 5 Apr 2016 16:59:18 +0000 (19:59 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 5 Apr 2016 16:59:18 +0000 (19:59 +0300)
This seems to be happening especially with dsync migrations from IMAP
servers with small timeouts. The initial dsync run opens imapc connection
early to do a LIST + SELECT the first mailbox, but then dsync may spend a
while creating all the local mailboxes before it continues using the imapc
connection.

src/lib-imap-client/imapc-client.c
src/lib-storage/index/imapc/imapc-storage.c

index fda363eb8ac303f0fba5ddefa7bfda38250e04c3..f23c39e9996d87bf327e52a3b6008b3c38fd740c 100644 (file)
@@ -277,6 +277,9 @@ imapc_client_mailbox_open(struct imapc_client *client,
        conn->box = box;
        box->conn = conn->conn;
        box->msgmap = imapc_msgmap_init();
+       /* if we get disconnected before the SELECT is finished, allow
+          one reconnect retry. */
+       box->reconnect_ok = TRUE;
        return box;
 }
 
index e485622c8d8c07c738fada3da367ce6f10e4a623..514722fe30e576667ad55484a413a8dc40742b03 100644 (file)
@@ -564,7 +564,8 @@ int imapc_mailbox_select(struct imapc_mailbox *mbox)
        ctx.ret = -2;
        cmd = imapc_client_mailbox_cmd(mbox->client_box,
                                       imapc_mailbox_open_callback, &ctx);
-       imapc_command_set_flags(cmd, IMAPC_COMMAND_FLAG_SELECT);
+       imapc_command_set_flags(cmd, IMAPC_COMMAND_FLAG_SELECT |
+                               IMAPC_COMMAND_FLAG_RETRIABLE);
        if (imapc_mailbox_want_examine(mbox)) {
                imapc_command_sendf(cmd, "EXAMINE %s",
                        imapc_mailbox_get_remote_name(mbox));