[geary: 14/14] Merge branch 'wip/713006-better-error-reporting'. Fixes Bug 713006.



commit d1d8d6411ed5d15c0aa842e4fa4d9f66e690ed0b
Merge: a226d0c 8c2a4fc
Author: Michael James Gratton <mike vee net>
Date:   Sun Nov 19 18:35:06 2017 +1100

    Merge branch 'wip/713006-better-error-reporting'. Fixes Bug 713006.

 INSTALL                                            |    6 +-
 bindings/vapi/libunwind.vapi                       |   91 ++++++
 debian/control                                     |    2 +
 po/POTFILES.in                                     |    3 +
 src/CMakeLists.txt                                 |    4 +
 src/client/application/geary-controller.vala       |   98 ++++--
 src/client/components/main-window-info-bar.vala    |  324 ++++++++++++++++++++
 src/client/components/main-window.vala             |   21 ++
 src/engine/api/geary-account.vala                  |  182 +++++++-----
 src/engine/api/geary-endpoint.vala                 |    2 +-
 src/engine/api/geary-folder.vala                   |    5 +-
 src/engine/api/geary-problem-report.vala           |  222 ++++++++++++++
 src/engine/imap-db/imap-db-account.vala            |    7 +-
 src/engine/imap-db/outbox/smtp-outbox-folder.vala  |  193 +++++++-----
 .../imap-engine/imap-engine-generic-account.vala   |   74 ++---
 src/engine/imap/api/imap-account.vala              |  112 ++++++--
 .../transport/imap-client-session-manager.vala     |   95 +++---
 src/engine/smtp/smtp-error.vala                    |   31 ++-
 src/engine/util/util-connectivity-manager.vala     |   94 +++++--
 ui/CMakeLists.txt                                  |    1 +
 ui/geary.css                                       |   10 +
 ui/main-window-info-bar.ui                         |  153 +++++++++
 ui/main-window.ui                                  |  114 +++++--
 23 files changed, 1479 insertions(+), 365 deletions(-)
---
diff --cc src/engine/imap/api/imap-account.vala
index 4bf89f0,9550873..ac3d746
--- a/src/engine/imap/api/imap-account.vala
+++ b/src/engine/imap/api/imap-account.vala
@@@ -42,7 -42,10 +43,8 @@@ private class Geary.Imap.Account : Base
      private Gee.List<MailboxInformation>? list_collector = null;
      private Gee.List<StatusData>? status_collector = null;
      private Gee.List<ServerData>? server_data_collector = null;
 -    private Imap.MailboxSpecifier? inbox_specifier = null;
 -    private string hierarchy_delimiter = null;
  
+ 
      /**
       * Fired after opening when the account has a working connection.
       *
@@@ -569,42 -619,24 +575,49 @@@
          return responses;
      }
  
+     private void check_open() throws Error {
+         if (!is_open)
+             throw new EngineError.OPEN_REQUIRED("Imap.Account not open");
+     }
+ 
 +    private inline Imap.Folder newUnselectableFolder(FolderPath path, MailboxAttributes attrs) {
 +        return new Imap.Folder(
 +            path, new Imap.FolderProperties(0, 0, 0, null, null, attrs), this.session_mgr
 +        );
 +    }
 +
+     private void notify_report_problem(ProblemType problem, Error? err) {
+         report_problem(new ServiceProblemReport(problem, this.account, Service.IMAP, err));
+     }
+ 
      [NoReturn]
      private void throw_not_found(Geary.FolderPath? path) throws EngineError {
          throw new EngineError.NOT_FOUND("Folder %s not found on %s",
              (path != null) ? path.to_string() : "root", session_mgr.to_string());
      }
  
-     private void on_login_failed(StatusResponse? response) {
-         login_failed(account_information.imap_credentials, response);
-     }
- 
 +    private void on_list_data(MailboxInformation mailbox_info) {
 +        if (list_collector != null)
 +            list_collector.add(mailbox_info);
 +    }
 +
 +    private void on_status_data(StatusData status_data) {
 +        if (status_collector != null)
 +            status_collector.add(status_data);
 +    }
 +
 +    private void on_server_data_received(ServerData server_data) {
 +        if (server_data_collector != null)
 +            server_data_collector.add(server_data);
 +    }
 +
 +    private void on_disconnected() {
 +        drop_session_async.begin(null);
 +    }
 +
      private void on_session_ready() {
+         // Now have a valid session, so credentials must be good
+         this.authentication_failures = 0;
          ready();
      }
  
diff --cc src/engine/util/util-connectivity-manager.vala
index cf84fcc,226f1de..821fec9
--- a/src/engine/util/util-connectivity-manager.vala
+++ b/src/engine/util/util-connectivity-manager.vala
@@@ -20,31 -20,41 +20,49 @@@
   */
  public class Geary.ConnectivityManager : BaseObject {
  
- 
 +    private const uint CHECK_QUIESCENCE_MS = 60 * 1000;
 +
 +
-       /** Determines if the managed endpoint is currently reachable. */
-       public bool is_reachable { get; private set; default = false; }
+     /** The address being monitored. */
+     public NetworkAddress address { get; private set; default = null; }
+ 
+       /** Determines if the managed address is currently reachable. */
+       public Trillian is_reachable { get; private set; default = Geary.Trillian.UNKNOWN; }
  
-     // Weak to avoid a circular ref with the endpoint
-     private weak Endpoint endpoint;
+       /**
+      * Determines if a the address's network address name is valid.
+      *
+      * This will become certain if the address becomes reachable, and
+      * will become impossible if a fatal address error is reported.
+      */
+       public Trillian is_valid { get; private set; default = Geary.Trillian.UNKNOWN; }
  
      private NetworkMonitor monitor;
  
        private Cancellable? existing_check = null;
  
 +    // Wall time the next already-connected check should not occur before
 +    private int64 next_check = 0;
 +
 +    private TimeoutManager delayed_check;
 +
  
      /**
-      * Constructs a new manager for a specific endpoint.
+      * Fired when a fatal error was reported checking the address.
+      *
+      * This is typically caused by an an authoritative DNS name not
+      * found error, but may be anything else that indicates that the
+      * address will be unusable as-is without some kind of user or
+      * server administrator intervention.
       */
-     public ConnectivityManager(Endpoint endpoint) {
-               this.endpoint = endpoint;
+     public signal void address_error_reported(Error error);
+ 
+ 
+     /**
+      * Constructs a new manager for a specific address.
+      */
+     public ConnectivityManager(NetworkAddress address) {
+               this.address = address;
  
          this.monitor = NetworkMonitor.get_default();
          this.monitor.network_changed.connect(on_network_changed);
@@@ -76,15 -82,11 +94,14 @@@
                Cancellable cancellable = new Cancellable();
                this.existing_check = cancellable;
  
-               string endpoint = this.endpoint.to_string();
-               bool is_reachable = this.is_reachable;
+         string endpoint = to_address_string();
+               bool is_reachable = false;
          try {
                        debug("Checking if %s reachable...", endpoint);
 -            is_reachable = yield this.monitor.can_reach_async(this.address, cancellable);
 +            is_reachable = yield this.monitor.can_reach_async(
-                               this.endpoint.remote_address,
-                               cancellable
++                              this.address, cancellable
 +                      );
 +            this.next_check = get_real_time() + CHECK_QUIESCENCE_MS;
          } catch (Error err) {
              if (err is IOError.NETWORK_UNREACHABLE &&
                                this.monitor.network_available) {
@@@ -126,26 -135,11 +151,26 @@@
                debug("Network changed: %s",
                some_available ? "some available" : "none available");
                if (some_available) {
 -                      // Some hosts may have dropped out despite network being
 -                      // still xavailable, so need to check again
 -                      this.check_reachable.begin();
 +                      // Some networks may have dropped out despite some being
 +                      // still available, so need to check again. Only run the
 +                      // check if we are either currently:
 +            //
 +            // 1. Unreachable
 +            // 2. An existing check is already running (i.e. the
 +            //    network configuration is changing)
 +            // 3. Reachable, and a check hasn't been run recently
 +            //
 +            // Otherwise, schedule a delayed check to work around the
 +            // issue in Bug 776042.
-             if (!this.is_reachable ||
++            if (this.is_reachable.is_uncertain() ||
 +                this.existing_check != null ||
 +                this.next_check <= get_real_time()) {
 +                this.check_reachable.begin();
 +            } else if (!this.delayed_check.is_running) {
 +                this.delayed_check.start();
 +            }
                } else {
 -                      // None available, so definitely not reachable
 +                      // None available, so definitely not reachable.
                        set_reachable(false);
                }
      }


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