dhcp/nettools: add helper function dhcp4_event_pop_all_events()

Will be used next.
This commit is contained in:
Thomas Haller 2022-05-24 15:36:14 +02:00
parent 85b15e02fd
commit 8f8839dd2a
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -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;
}