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:
Wang King 2017-05-18 12:06:41 +08:00 committed by John Ferlan
parent a0a0b3cf71
commit c886b5d153

View File

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