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

Re: [imapsync] patch for 1.267: must log errors when disconnected


From Phil Lobbes <plobbes at zimbra dot com>
Subject Re: [imapsync] patch for 1.267: must log errors when disconnected
Date Fri, 13 Feb 2009 17:44:51 -0800 (PST)

To be more correct,  we probably should not call *->logout unless we're connected:

Change this:
  $from->logout();
  $to->logout();

To this:
  $from->logout() unless $from->isUnconnected();
  $to->logout()   unless $to->isUnconnected();

Phil

----- Original Message -----
From: "Phil Lobbes" <plobbes at zimbra dot com>
To: imapsync at linux-france dot org
Sent: Saturday, January 31, 2009 4:11:41 PM GMT -05:00 US/Canada Eastern
Subject: [imapsync] patch for 1.267: must log errors when disconnected

Here's a patch for this bug that I reported a long time ago.  This is short and simple enough that hopefully it will get included.

This patch addresses numerous cases where imapsync might not report an error even if all folder were NOT successfully sync'd because of a dropped network connection.

Phil
-- 
Phil Lobbes
Zimbra, a Yahoo! company

--- imapsync.ORIG	2009-01-31 16:03:52.066125000 -0500
+++ imapsync	2009-01-31 16:04:42.159875000 -0500
@@ -1625,7 +1625,19 @@
 print "Time : ", timenext(), " s\n";
 }
 
-
+# FOLDER loop is exited any time a connection is lost be sure to log it!
+if ( $from->IsUnconnected() or $to->IsUnconnected() ) {
+	my @err;
+	if ( $from->IsUnconnected() ) {
+		$error++;
+		push( @err, "(from) host1[$host1]" );
+	}
+	if ( $to->IsUnconnected() ) {
+		$error++;
+		push( @err, "(to) host2[$host2]" );
+	}
+	warn("error: lost connection(s): @err\n");
+}
 
 $from->logout();
 $to->logout();

---- imapsync mailing-list ----
unsubscribe, mailto:imapsync-unsubscribe at listes dot linux-france dot org
imapsync,    http://linux-france.org/prj/imapsync/