mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
remote: Extract common clearing of event callbacks of client private data
Extract common clearing of event callbacks as remoteClientFreePrivateCallbacks. the common function also separation including the sysident handling.
This commit is contained in:
parent
d09429abe8
commit
60e8bbc4c5
@ -1689,21 +1689,11 @@ void remoteRelayConnectionClosedEvent(virConnectPtr conn ATTRIBUTE_UNUSED, int r
|
||||
neventCallbacks = 0; \
|
||||
} while (0);
|
||||
|
||||
/*
|
||||
* You must hold lock for at least the client
|
||||
* We don't free stuff here, merely disconnect the client's
|
||||
* network socket & resources.
|
||||
* We keep the libvirt connection open until any async
|
||||
* jobs have finished, then clean it up elsewhere
|
||||
*/
|
||||
void remoteClientFreeFunc(void *data)
|
||||
|
||||
static void
|
||||
remoteClientFreePrivateCallbacks(struct daemonClientPrivate *priv)
|
||||
{
|
||||
struct daemonClientPrivate *priv = data;
|
||||
|
||||
/* Deregister event delivery callback */
|
||||
if (priv->conn) {
|
||||
virIdentityPtr sysident = virIdentityGetSystem();
|
||||
|
||||
virIdentitySetCurrent(sysident);
|
||||
|
||||
DEREG_CB(priv->conn, priv->domainEventCallbacks,
|
||||
@ -1731,17 +1721,32 @@ void remoteClientFreeFunc(void *data)
|
||||
VIR_WARN("unexpected close callback event deregister failure");
|
||||
}
|
||||
|
||||
virConnectClose(priv->conn);
|
||||
|
||||
virIdentitySetCurrent(NULL);
|
||||
virObjectUnref(sysident);
|
||||
}
|
||||
|
||||
VIR_FREE(priv);
|
||||
}
|
||||
#undef DEREG_CB
|
||||
|
||||
|
||||
/*
|
||||
* You must hold lock for at least the client
|
||||
* We don't free stuff here, merely disconnect the client's
|
||||
* network socket & resources.
|
||||
* We keep the libvirt connection open until any async
|
||||
* jobs have finished, then clean it up elsewhere
|
||||
*/
|
||||
void remoteClientFreeFunc(void *data)
|
||||
{
|
||||
struct daemonClientPrivate *priv = data;
|
||||
|
||||
/* Deregister event delivery callback */
|
||||
if (priv->conn) {
|
||||
remoteClientFreePrivateCallbacks(priv);
|
||||
virConnectClose(priv->conn);
|
||||
}
|
||||
VIR_FREE(priv);
|
||||
}
|
||||
|
||||
|
||||
static void remoteClientCloseFunc(virNetServerClientPtr client)
|
||||
{
|
||||
struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client);
|
||||
|
Loading…
Reference in New Issue
Block a user