changeset 18884:f06008be0d1d

imapc: If login is aborted at deinit, don't log an error.
author Timo Sirainen <tss@iki.fi>
date Tue, 23 Jun 2015 11:12:38 +0200
parents 771254b34a42
children 563b93302831
files src/lib-storage/index/imapc/imapc-list.c src/lib-storage/index/imapc/imapc-storage.c src/lib-storage/index/imapc/imapc-storage.h
diffstat 3 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/imapc/imapc-list.c	Tue Jun 23 11:02:20 2015 +0200
+++ b/src/lib-storage/index/imapc/imapc-list.c	Tue Jun 23 11:12:38 2015 +0200
@@ -87,6 +87,8 @@
 {
 	struct imapc_mailbox_list *list = (struct imapc_mailbox_list *)_list;
 
+	list->client->destroying = TRUE;
+
 	/* make sure all pending commands are aborted before anything is
 	   deinitialized */
 	if (list->client != NULL) {
--- a/src/lib-storage/index/imapc/imapc-storage.c	Tue Jun 23 11:02:20 2015 +0200
+++ b/src/lib-storage/index/imapc/imapc-storage.c	Tue Jun 23 11:12:38 2015 +0200
@@ -207,6 +207,12 @@
 
 	if (reply->state == IMAPC_COMMAND_STATE_OK)
 		return;
+	if (client->destroying &&
+	    reply->state == IMAPC_COMMAND_STATE_DISCONNECTED) {
+		/* user's work was finished before imapc login finished -
+		   it's not an error */
+		return;
+	}
 
 	i_error("imapc: Authentication failed: %s", reply->text_full);
 	client->auth_failed = TRUE;
@@ -350,6 +356,8 @@
 {
 	struct imapc_storage *storage = (struct imapc_storage *)_storage;
 
+	storage->client->destroying = TRUE;
+
 	/* make sure all pending commands are aborted before anything is
 	   deinitialized */
 	imapc_client_disconnect(storage->client->client);
--- a/src/lib-storage/index/imapc/imapc-storage.h	Tue Jun 23 11:02:20 2015 +0200
+++ b/src/lib-storage/index/imapc/imapc-storage.h	Tue Jun 23 11:12:38 2015 +0200
@@ -52,6 +52,7 @@
 	ARRAY(struct imapc_storage_event_callback) untagged_callbacks;
 
 	unsigned int auth_failed:1;
+	unsigned int destroying:1;
 };
 
 struct imapc_storage {