mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-26 23:55:23 +00:00
remote: push check for conn down into remoteClientFreePrivateCallbacks
There will shortly be many connection objects, so we should not assume a single check against priv->conn is sufficient. Reviewed-by: John Ferlan <jferlan@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
3c9ba9c1cd
commit
6f9750012c
@ -1673,6 +1673,11 @@ void remoteRelayConnectionClosedEvent(virConnectPtr conn ATTRIBUTE_UNUSED, int r
|
|||||||
#define DEREG_CB(conn, eventCallbacks, neventCallbacks, deregFcn, name) \
|
#define DEREG_CB(conn, eventCallbacks, neventCallbacks, deregFcn, name) \
|
||||||
do { \
|
do { \
|
||||||
size_t i; \
|
size_t i; \
|
||||||
|
if (neventCallbacks && !conn) { \
|
||||||
|
VIR_WARN("Have %zu %s event callbacks but no connection", \
|
||||||
|
neventCallbacks, name); \
|
||||||
|
break; \
|
||||||
|
} \
|
||||||
for (i = 0; i < neventCallbacks; i++) { \
|
for (i = 0; i < neventCallbacks; i++) { \
|
||||||
int callbackID = eventCallbacks[i]->callbackID; \
|
int callbackID = eventCallbacks[i]->callbackID; \
|
||||||
if (callbackID < 0) { \
|
if (callbackID < 0) { \
|
||||||
@ -1715,7 +1720,7 @@ remoteClientFreePrivateCallbacks(struct daemonClientPrivate *priv)
|
|||||||
priv->nqemuEventCallbacks,
|
priv->nqemuEventCallbacks,
|
||||||
virConnectDomainQemuMonitorEventDeregister, "qemu monitor");
|
virConnectDomainQemuMonitorEventDeregister, "qemu monitor");
|
||||||
|
|
||||||
if (priv->closeRegistered) {
|
if (priv->closeRegistered && priv->conn) {
|
||||||
if (virConnectUnregisterCloseCallback(priv->conn,
|
if (virConnectUnregisterCloseCallback(priv->conn,
|
||||||
remoteRelayConnectionClosedEvent) < 0)
|
remoteRelayConnectionClosedEvent) < 0)
|
||||||
VIR_WARN("unexpected close callback event deregister failure");
|
VIR_WARN("unexpected close callback event deregister failure");
|
||||||
@ -1751,9 +1756,7 @@ static void remoteClientCloseFunc(virNetServerClientPtr client)
|
|||||||
|
|
||||||
daemonRemoveAllClientStreams(priv->streams);
|
daemonRemoveAllClientStreams(priv->streams);
|
||||||
|
|
||||||
/* Deregister event delivery callback */
|
remoteClientFreePrivateCallbacks(priv);
|
||||||
if (priv->conn)
|
|
||||||
remoteClientFreePrivateCallbacks(priv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user