mirror of https://gitee.com/openkylin/libvirt.git
Misc fixes to event registration failure cases
This commit is contained in:
parent
41f14d6ea5
commit
660418cff4
|
@ -1,3 +1,10 @@
|
|||
Fri Nov 21 10:20:14 BST 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
* src/remote_internal.c: Return VIR_NO_SUPPORT if requested
|
||||
to register event callbacks when no eventloop is present.
|
||||
Deal with failure to register handles/timers correctly.
|
||||
(David Lively)
|
||||
|
||||
Fri Nov 21 10:14:14 BST 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||
|
||||
Fix crash due to failure to unregister event callbacks on
|
||||
|
|
|
@ -773,6 +773,7 @@ doRemoteOpen (virConnectPtr conn,
|
|||
conn, NULL)) < 0) {
|
||||
DEBUG0("virEventAddTimeout failed: No addTimeoutImpl defined. "
|
||||
"continuing without events.");
|
||||
virEventRemoveHandle(priv->watch);
|
||||
}
|
||||
}
|
||||
/* Successful. */
|
||||
|
@ -1211,10 +1212,12 @@ doRemoteClose (virConnectPtr conn, struct private_data *priv)
|
|||
(xdrproc_t) xdr_void, (char *) NULL) == -1)
|
||||
return -1;
|
||||
|
||||
/* Remove handle for remote events */
|
||||
virEventRemoveHandle(priv->sock);
|
||||
/* Remove timout */
|
||||
virEventRemoveTimeout(priv->eventFlushTimer);
|
||||
if (priv->eventFlushTimer >= 0) {
|
||||
/* Remove timeout */
|
||||
virEventRemoveTimeout(priv->eventFlushTimer);
|
||||
/* Remove handle for remote events */
|
||||
virEventRemoveHandle(priv->watch);
|
||||
}
|
||||
|
||||
/* Close socket. */
|
||||
if (priv->uses_tls && priv->session) {
|
||||
|
@ -4483,6 +4486,10 @@ static int remoteDomainEventRegister (virConnectPtr conn,
|
|||
{
|
||||
struct private_data *priv = conn->privateData;
|
||||
|
||||
if (priv->eventFlushTimer < 0) {
|
||||
error (conn, VIR_ERR_NO_SUPPORT, _("no event support"));
|
||||
return -1;
|
||||
}
|
||||
if (virDomainEventCallbackListAdd(conn, priv->callbackList,
|
||||
callback, opaque, freecb) < 0) {
|
||||
error (conn, VIR_ERR_RPC, _("adding cb to list"));
|
||||
|
|
Loading…
Reference in New Issue