mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 22:25:25 +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
|
||||
virNetlinkEventServiceStopAll(void)
|
||||
{
|
||||
size_t i, j;
|
||||
virNetlinkEventSrvPrivatePtr srv = NULL;
|
||||
size_t i;
|
||||
|
||||
VIR_INFO("stopping all netlink event services");
|
||||
|
||||
for (i = 0; i < MAX_LINKS; i++) {
|
||||
srv = server[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);
|
||||
}
|
||||
for (i = 0; i < MAX_LINKS; i++)
|
||||
virNetlinkEventServiceStop(i);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user