[calls/gnome-41] network-watch: Don't fail initialization when unable to fetch local IP



commit 432c7fd0d2b559e0d09515774ba58119167f611c
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date:   Thu Sep 16 15:58:16 2021 +0200

    network-watch: Don't fail initialization when unable to fetch local IP
    
    This would mean we're failing when Calls is started with all NICs not connected
    or disabled. To make matters worse this would only be fixable by restarting
    Calls.
    
    (cherry picked from commit b5defda27f5d09f315fbecfcf3b08410c0ce7b2a)

 src/calls-network-watch.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/src/calls-network-watch.c b/src/calls-network-watch.c
index d619da83..46216d40 100644
--- a/src/calls-network-watch.c
+++ b/src/calls-network-watch.c
@@ -396,7 +396,6 @@ calls_network_watch_initable_init (GInitable    *initable,
                                    GError      **error)
 {
   CallsNetworkWatch *self = CALLS_NETWORK_WATCH (initable);
-  gboolean ret = FALSE;
 
   self->fd = socket (AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
   if (self->fd == -1 && error) {
@@ -406,16 +405,17 @@ calls_network_watch_initable_init (GInitable    *initable,
     return FALSE;
   }
 
-  if (fetch_ipv4 (self)) {
-    ret = TRUE;
+  if (fetch_ipv4 (self))
     self->ipv4 = g_strdup (self->tmp_addr);
-  }
-  if (fetch_ipv6 (self)) {
-    ret = TRUE;
+  else
+    self->ipv4 = g_strdup ("127.0.0.1");
+
+  if (fetch_ipv6 (self))
     self->ipv6 = g_strdup (self->tmp_addr);
-  }
+  else
+    self->ipv6 = g_strdup ("::1");
 
-  return ret;
+  return TRUE;
 }
 
 


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