Review request: IMAP4 email account automatic sync interval update not working



Hello all,
Please, review the attached patch and integrate it if it looks fine.

Here is some info:
1) Baseline code location:
URL: http://git.gitorious.org/tinymail/tinymail.git
Branch: tinymail-1-2
Commit: 5ad7626d4119f1d045941425b0873aa36190458c

2) Fixed bug: 159563 - IMAP4 email account automatic sync interval update not working;
Link: https://projects.maemo.org/bugzilla/show_bug.cgi?id=159563

3) Fix information:
For kolumbus.fi IMAP service provider, the scheduled (and sometimes manual) synchronizations fails. The problem was that during synchronization tinymail receives "Connection Reset by Peer" error on its first IMAP request (LIST "" *). Once received the error condition, the IMAP tinymail plugin resets the connection (disconnects/connects again) but does not try to issue the IMAP request after that. I added resending the request as soon as the connection is reset. For me this worked all the time and after reconnection the IMAP command always worked for me, synchronization succeeded.

Please, let me know if something is wrong with this fix.

Thank you,
Alexander


Alexander Chumakov
Architect

Teleca
24 Salganskaya St., Nizhny Novgorod, 603105, Russia
Phone: +78312788198, Fax: +78312577230
Alexander Chumakov teleca com
http://www.teleca.com/

Follow what's going on at Teleca's blog on http://www.whatsyourideaoftomorrow.blogspot.com/.

The information contained in this message is confidential and is intended for the addressee(s) only. If you have received this message in error please notify the sender immediately. The unauthorized use, disclosure, copying or alteration of this message is strictly prohibited.

>From 80f18fdae2cdc038bb2c30ec92117f92e780b4a7 Mon Sep 17 00:00:00 2001
From: alexander chumakov <alexander chumakov teleca com>
Date: Tue, 6 Apr 2010 09:01:14 +0400
Subject: [PATCH 1/2] Fixed IMAP automatic sync for some email servers

Fixes: bug #159563;
---
 .../camel/providers/imap/camel-imap-store.c        |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c b/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c
index fa8d285..a63f214 100644
--- a/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c
+++ b/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c
@@ -4022,12 +4022,14 @@ get_folders_sync_ns(CamelImapStore *imap_store, struct _namespace *namespace, gb
 				loops = 2;
 		}
 	} else {
+		guint retries;
 
 		/* If we don't have LIST-EXTENDED we'll have to ask both the
 		   LIST and the LSUB (this one is about the personal namespace,
 		   so recursively asking for all is probably fine). */
 
 		loops = 2;
+		retries = 1;
 
 		for (j = 0; j < loops; j++) {
 
@@ -4044,8 +4046,17 @@ get_folders_sync_ns(CamelImapStore *imap_store, struct _namespace *namespace, gb
 				"%s \"%s\" %s", (j==1 || j==3) ? "LSUB" : "LIST", 
 				prefix, (j!=1 && j!=3) ? lst : "*");
 
-			if (!response)
-				goto fail;
+			if (!response) {
+				if (retries--) {
+					/* the command failed, try again */
+					--j;
+					camel_exception_clear (ex);
+					continue;
+				}
+				else {
+					goto fail;
+				}
+			}
 
 			for (i = 0; i < response->untagged->len; i++) 
 			{
-- 
1.7.0



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]