summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-05-24 15:36:14 +0200
committerThomas Haller <thaller@redhat.com>2022-05-31 18:32:35 +0200
commit8f8839dd2abf3789c41abebda71e4577045d3371 (patch)
treebe7ee5213b0ea817e949067c4d7c83165c6752be
parent85b15e02fdd32afbe081266592177b1f86f5dce7 (diff)
downloadNetworkManager-8f8839dd2abf3789c41abebda71e4577045d3371.tar.gz
dhcp/nettools: add helper function dhcp4_event_pop_all_events()
Will be used next.
-rw-r--r--src/core/dhcp/nm-dhcp-nettools.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/core/dhcp/nm-dhcp-nettools.c b/src/core/dhcp/nm-dhcp-nettools.c
index 4b580b47ef..c012c024d2 100644
--- a/src/core/dhcp/nm-dhcp-nettools.c
+++ b/src/core/dhcp/nm-dhcp-nettools.c
@@ -992,12 +992,21 @@ dhcp4_event_handle(NMDhcpNettools *self, NDhcp4ClientEvent *event)
}
}
+static void
+dhcp4_event_pop_all_events(NMDhcpNettools *self)
+{
+ NMDhcpNettoolsPrivate *priv = NM_DHCP_NETTOOLS_GET_PRIVATE(self);
+ NDhcp4ClientEvent *event;
+
+ while (!n_dhcp4_client_pop_event(priv->client, &event) && event)
+ dhcp4_event_handle(self, event);
+}
+
static gboolean
dhcp4_event_cb(int fd, GIOCondition condition, gpointer user_data)
{
NMDhcpNettools *self = user_data;
NMDhcpNettoolsPrivate *priv = NM_DHCP_NETTOOLS_GET_PRIVATE(self);
- NDhcp4ClientEvent *event;
int r;
r = n_dhcp4_client_dispatch(priv->client);
@@ -1018,8 +1027,7 @@ dhcp4_event_cb(int fd, GIOCondition condition, gpointer user_data)
return G_SOURCE_REMOVE;
}
- while (!n_dhcp4_client_pop_event(priv->client, &event) && event)
- dhcp4_event_handle(self, event);
+ dhcp4_event_pop_all_events(self);
return G_SOURCE_CONTINUE;
}