[calls] network-watch: More descriptive warning



commit 4fc0a52873d855435244af7cb1dedaf368ecb6c2
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date:   Thu Sep 16 17:18:35 2021 +0200

    network-watch: More descriptive warning
    
    And make sure we're not continually spamming warnings.
    
    Closes #330

 src/calls-network-watch.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/src/calls-network-watch.c b/src/calls-network-watch.c
index 49cee6ae..e1111c4b 100644
--- a/src/calls-network-watch.c
+++ b/src/calls-network-watch.c
@@ -76,6 +76,8 @@ typedef struct _CallsNetworkWatch {
 
   guint timeout_id;
 
+  gboolean repeated_warning;
+
   char *ipv4;
   char *ipv6;
   char tmp_addr[INET6_ADDRSTRLEN];
@@ -195,10 +197,17 @@ talk_rtnl (CallsNetworkWatch *self)
 
   h = (struct nlmsghdr *) self->buf;
   if (h->nlmsg_type == NLMSG_ERROR) {
-    g_warning ("An error occured in the netlink stack");
+    /* TODO figure out why this fails and provide more information in the warning */
+    if (!self->repeated_warning)
+      g_warning ("Unexpected error response to netlink request while trying "
+                 "to fetch local IP address");
+
+    self->repeated_warning = TRUE;
     return FALSE;
   }
 
+  self->repeated_warning = FALSE;
+
   return TRUE;
 }
 


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