mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-06 13:20:20 +00:00
util: Deduplicate code in virNetlinkEventServiceStopAll
Commit 15a71e60
introduced the virNetlinkEventServiceStopAll function, and
the code in virNetlinkEventServiceStop is copied to this function, so just
call virNetlinkEventServiceStop instead.
This commit is contained in:
parent
a0a0b3cf71
commit
c886b5d153
@ -775,32 +775,12 @@ virNetlinkEventServiceStop(unsigned int protocol)
|
|||||||
int
|
int
|
||||||
virNetlinkEventServiceStopAll(void)
|
virNetlinkEventServiceStopAll(void)
|
||||||
{
|
{
|
||||||
size_t i, j;
|
size_t i;
|
||||||
virNetlinkEventSrvPrivatePtr srv = NULL;
|
|
||||||
|
|
||||||
VIR_INFO("stopping all netlink event services");
|
VIR_INFO("stopping all netlink event services");
|
||||||
|
|
||||||
for (i = 0; i < MAX_LINKS; i++) {
|
for (i = 0; i < MAX_LINKS; i++)
|
||||||
srv = server[i];
|
virNetlinkEventServiceStop(i);
|
||||||
if (!srv)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
virNetlinkEventServerLock(srv);
|
|
||||||
nl_close(srv->netlinknh);
|
|
||||||
virNetlinkFree(srv->netlinknh);
|
|
||||||
virEventRemoveHandle(srv->eventwatch);
|
|
||||||
|
|
||||||
for (j = 0; j < srv->handlesCount; j++) {
|
|
||||||
if (srv->handles[j].deleted == VIR_NETLINK_HANDLE_VALID)
|
|
||||||
virNetlinkEventRemoveClientPrimitive(j, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
server[i] = NULL;
|
|
||||||
virNetlinkEventServerUnlock(srv);
|
|
||||||
|
|
||||||
virMutexDestroy(&srv->lock);
|
|
||||||
VIR_FREE(srv);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user