changeset 21281:1ba00e3ae6cd

imapc: Don't send NOOP immediately after SELECT NOOP is normally used by mailbox syncing to check if there are any changes done by other concurrent IMAP sessions. But doing it immediately after SELECT is unnecessary, because nothing could have changed.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Fri, 09 Dec 2016 15:06:05 +0200
parents 953aac0beb29
children f1164511f6e5
files src/lib-storage/index/imapc/imapc-sync.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/imapc/imapc-sync.c	Fri Dec 09 11:11:11 2016 +0000
+++ b/src/lib-storage/index/imapc/imapc-sync.c	Fri Dec 09 15:06:05 2016 +0200
@@ -550,8 +550,11 @@
 	enum imapc_capability capabilities;
 
 	capabilities = imapc_client_get_capabilities(mbox->storage->client->client);
-	if ((capabilities & IMAPC_CAPABILITY_IDLE) == 0 ||
-	    (flags & MAILBOX_SYNC_FLAG_FULL_READ) != 0) {
+	if (!mbox->initial_sync_done) {
+		/* we just SELECTed/EXAMINEd the mailbox, don't do another
+		   NOOP. */
+	} else if ((capabilities & IMAPC_CAPABILITY_IDLE) == 0 ||
+		   (flags & MAILBOX_SYNC_FLAG_FULL_READ) != 0) {
 		/* do NOOP to make sure we have the latest changes before
 		   starting sync. this is necessary either because se don't
 		   support IDLE at all, or because we want to be sure that we