[geary] Better handle SMTP outbox and IMAP connections being cancelled.



commit 16abac42b812c7bf00ad68f171494f917525bfd8
Author: Michael James Gratton <mike vee net>
Date:   Mon May 28 01:34:08 2018 +1000

    Better handle SMTP outbox and IMAP connections being cancelled.

 src/engine/imap-db/outbox/smtp-outbox-folder.vala  |  5 +++++
 src/engine/imap/transport/imap-client-session.vala | 14 +++++++++-----
 2 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/src/engine/imap-db/outbox/smtp-outbox-folder.vala 
b/src/engine/imap-db/outbox/smtp-outbox-folder.vala
index 24b83c16..9bf335c3 100644
--- a/src/engine/imap-db/outbox/smtp-outbox-folder.vala
+++ b/src/engine/imap-db/outbox/smtp-outbox-folder.vala
@@ -145,6 +145,11 @@ private class Geary.SmtpOutboxFolder :
                 }
                 notify_report_problem(problem, err);
                 cancellable.cancel();
+            } catch (IOError.CANCELLED err) {
+                // Nothing to do here — we're already cancelled. In
+                // particular we don't want to report the cancelled
+                // error as a problem since this is the normal
+                // shutdown method.
             } catch (IOError err) {
                 notify_report_problem(ProblemType.for_ioerror(err), err);
                 cancellable.cancel();
diff --git a/src/engine/imap/transport/imap-client-session.vala 
b/src/engine/imap/transport/imap-client-session.vala
index cf303e83..0836743f 100644
--- a/src/engine/imap/transport/imap-client-session.vala
+++ b/src/engine/imap/transport/imap-client-session.vala
@@ -493,11 +493,11 @@ public class Geary.Imap.ClientSession : BaseObject {
             case State.BROKEN:
                 // no problem-o
             break;
-            
+
             default:
-                error("[%s] ClientSession ref dropped while still active", to_string());
+                warning("[%s] ClientSession ref dropped while still active", to_string());
         }
-        
+
         debug("DTOR: ClientSession %s", to_string());
     }
     
@@ -702,8 +702,12 @@ public class Geary.Imap.ClientSession : BaseObject {
         
         // wait for the initial greeting or a timeout ... this prevents the caller from turning
         // around and issuing a command while still in CONNECTING state
-        yield connect_waiter.wait_async(cancellable);
-        
+        try {
+            yield connect_waiter.wait_async(cancellable);
+        } catch (GLib.IOError.CANCELLED err) {
+            connect_err = err;
+        }
+
         // cancel the timeout, if it's not already fired
         timeout.cancel();
         


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