[geary/wip/cx-reestablish] Don't reestablish connection on soft error
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/cx-reestablish] Don't reestablish connection on soft error
- Date: Wed, 14 Jan 2015 19:26:34 +0000 (UTC)
commit 806bc7d08e55aabf2fbdf12d479e5339cce79db6
Author: Jim Nelson <jim yorba org>
Date: Wed Jan 14 11:26:16 2015 -0800
Don't reestablish connection on soft error
.../imap-engine/imap-engine-minimal-folder.vala | 25 +++++++++++++------
1 files changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/src/engine/imap-engine/imap-engine-minimal-folder.vala
b/src/engine/imap-engine/imap-engine-minimal-folder.vala
index b284114..11c262e 100644
--- a/src/engine/imap-engine/imap-engine-minimal-folder.vala
+++ b/src/engine/imap-engine/imap-engine-minimal-folder.vala
@@ -616,7 +616,10 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
try {
yield opening_folder.close_async(null);
} catch (Error err) {
- debug("Error closing remote folder %s: %s", opening_folder.to_string(), err.message);
+ debug("%s: Error closing remote folder %s: %s", to_string(), opening_folder.to_string(),
+ err.message);
+
+ // fall through
}
// stop before starting the close
@@ -657,13 +660,17 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
remote_reason = CloseReason.REMOTE_ERROR;
} else {
// soft failure, treat as failure to open
- debug("Soft failure opening or preparing remote folder %s: %s", to_string(),
+ debug("Soft failure opening or preparing remote folder %s, closing: %s", to_string(),
open_err.message);
notify_open_failed(
is_cancellation ? Folder.OpenFailed.CANCELLED : Folder.OpenFailed.REMOTE_FAILED,
open_err);
remote_reason = CloseReason.REMOTE_CLOSE;
+
+ // clear open_count to ensure that close_internal_async() doesn't attempt to
+ // reestablish the connection
+ open_count = 0;
}
// be sure to close opening_folder if it was fetched or opened
@@ -671,13 +678,14 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
if (opening_folder != null)
yield opening_folder.close_async(null);
} catch (Error err) {
- debug("Error closing remote folder %s: %s", opening_folder.to_string(), err.message);
+ debug("%s: Error closing remote folder %s: %s", to_string(), opening_folder.to_string(),
+ err.message);
}
// stop before starting the close
opening_monitor.notify_finish();
- // schedule immediate close and connection reestablishment
+ // schedule immediate close (and possible connection reestablishment)
close_internal_async.begin(CloseReason.LOCAL_CLOSE, remote_reason, false, null);
return;
@@ -694,7 +702,7 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
? remote_count
: yield local_folder.get_email_count_async(ImapDB.Folder.ListFlags.NONE, cancellable);
} catch (Error count_err) {
- debug("Unable to fetch count from local folder: %s", count_err.message);
+ debug("Unable to fetch count from local folder %s: %s", to_string(), count_err.message);
count = 0;
}
@@ -704,8 +712,8 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
try {
remote_semaphore.notify_result(remote_folder != null, null);
} catch (Error notify_err) {
- debug("Unable to fire semaphore notifying remote folder ready/not ready: %s",
- notify_err.message);
+ debug("%s: Unable to fire semaphore notifying remote folder ready/not ready: %s",
+ to_string(), notify_err.message);
// do this now rather than wait for close_internal_async() to execute to ensure that
// any replay operations already queued don't attempt to run
@@ -739,7 +747,8 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
cancellable);
}
- // NOTE: This bypasses open_count and forces the Folder closed.
+ // NOTE: This bypasses open_count and forces the Folder closed, reestablishing a connection if
+ // open_count is greater than zero
internal async void close_internal_async(Folder.CloseReason local_reason, Folder.CloseReason
remote_reason,
bool flush_pending, Cancellable? cancellable) {
cancel_remote_open_timer();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]