From 0380bc08ebbcc626a8775586e54ce3229d065413 Mon Sep 17 00:00:00 2001 From: Evangelos Ribeiro Tzaras Date: Thu, 16 Sep 2021 17:18:35 +0200 Subject: [PATCH] network-watch: More descriptive warning And make sure we're not continually spamming warnings. Closes #330 (cherry picked from commit 4fc0a52873d855435244af7cb1dedaf368ecb6c2) --- 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 49cee6a..e1111c4 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; }