[geary/wip/789924-network-transition-redux: 7/11] Avoid warning user of host unreachable errors when checking reachable.



commit f9cbcff9679326d52c14cac6aac045718508e584
Author: Michael James Gratton <mike vee net>
Date:   Sun Feb 4 08:39:21 2018 +1030

    Avoid warning user of host unreachable errors when checking reachable.
    
    These occur if checking reachability when the required host's network is
    unavaialble, i.e. when checking while being offline, hence there's not
    much point warning about it.
    
     * src/engine/util/util-connectivity-manager.vala (ConnectivityManager):
       Treat IOError.HOST_UNREACHABLE errors as simply being unreachable,
       not an error state.

 src/engine/util/util-connectivity-manager.vala |   23 ++++++++++++++++-------
 1 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/src/engine/util/util-connectivity-manager.vala b/src/engine/util/util-connectivity-manager.vala
index e4189eb..f9f77d7 100644
--- a/src/engine/util/util-connectivity-manager.vala
+++ b/src/engine/util/util-connectivity-manager.vala
@@ -115,15 +115,24 @@ public class Geary.ConnectivityManager : BaseObject {
                                is_reachable = true;
                                debug("Assuming %s is reachable, despite network unavailability",
                       endpoint);
-                       } else if (err is ResolverError.TEMPORARY_FAILURE) {
-                               // This often happens when networking is coming back
-                               // online, may because the interface is up but has not
-                               // been assigned an address yet? Since we should get
-                               // another network change when the interface is
-                               // configured, just ignore it.
+                       } else if (err is ResolverError.TEMPORARY_FAILURE ||
+                       err is IOError.HOST_UNREACHABLE) {
+                               // ResolverError.TEMPORARY_FAILURE often happens when
+                               // networking is coming back online, may because the
+                               // interface is up but has not been assigned an
+                               // address yet?
+                //
+                // IOError.HOST_UNREACHABLE occurs when checking when
+                // offline, perhaps because localhost is up but no
+                // other network is? So just assume the host is
+                // unreachable without notifying the user.
+                //
+                // Since we should get another network change signal
+                               // when the interface is configured, just treat these
+                               // as effectively being unreachable, but don't go
+                               // invalid.
                                debug("Ignoring: %s", err.message);
                        } else if (!(err is IOError.CANCELLED)) {
-                               // Service is unreachable
                                debug("Error checking %s reachable, treating as unreachable: %s",
                       endpoint, err.message);
                                set_invalid();


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