[geary/wip/workaround-gio-unknown-error] Retry IMAP pool connections on GLib "Unknown error on connect"
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/workaround-gio-unknown-error] Retry IMAP pool connections on GLib "Unknown error on connect"
- Date: Tue, 10 Sep 2019 12:45:53 +0000 (UTC)
commit ab941fe61f14005d12b64dbe907621de19ec4517
Author: Michael Gratton <mike vee net>
Date: Tue Sep 10 22:42:21 2019 +1000
Retry IMAP pool connections on GLib "Unknown error on connect"
Work around for GNOME/glib#1872 by waiting a second and retying when a
G_IO_ERROR_FAILED is received.
Revert this when that bug is fixed.
See #561
src/engine/imap/api/imap-client-service.vala | 28 +++++++++++++++++++++++++---
1 file changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/src/engine/imap/api/imap-client-service.vala b/src/engine/imap/api/imap-client-service.vala
index 6613c44d..ea891425 100644
--- a/src/engine/imap/api/imap-client-service.vala
+++ b/src/engine/imap/api/imap-client-service.vala
@@ -296,9 +296,31 @@ internal class Geary.Imap.ClientService : Geary.ClientService {
private async void add_pool_session() {
ClientSession? new_session = null;
try {
- new_session = yield this.create_new_authorized_session(
- this.pool_cancellable
- );
+ // Work around GNOME/glib#1872 by waiting a second and
+ // retying when a G_IO_ERROR_FAILED is received. Pull this
+ // loop out when that bug is fixed.
+ int attempts = 3;
+ while (new_session == null) {
+ try {
+ new_session = yield this.create_new_authorized_session(
+ this.pool_cancellable
+ );
+ } catch (GLib.IOError.FAILED err) {
+ if (--attempts > 0) {
+ debug(
+ "Generic error connecting, retrying after 1s: %s",
+ err.message
+ );
+ GLib.Timeout.add_seconds(
+ 1, this.add_pool_session.callback
+ );
+ yield;
+ } else {
+ throw err;
+ }
+ }
+ }
+ // === 8< === End of work-around === 8< ===
} catch (ImapError.UNAUTHENTICATED err) {
debug("Auth error adding new session to the pool: %s", err.message);
notify_authentication_failed();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]