mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-13 11:15:08 +00:00
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>
|
Fri Nov 21 10:14:14 BST 2008 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
Fix crash due to failure to unregister event callbacks on
|
Fix crash due to failure to unregister event callbacks on
|
||||||
|
@ -773,6 +773,7 @@ doRemoteOpen (virConnectPtr conn,
|
|||||||
conn, NULL)) < 0) {
|
conn, NULL)) < 0) {
|
||||||
DEBUG0("virEventAddTimeout failed: No addTimeoutImpl defined. "
|
DEBUG0("virEventAddTimeout failed: No addTimeoutImpl defined. "
|
||||||
"continuing without events.");
|
"continuing without events.");
|
||||||
|
virEventRemoveHandle(priv->watch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Successful. */
|
/* Successful. */
|
||||||
@ -1211,10 +1212,12 @@ doRemoteClose (virConnectPtr conn, struct private_data *priv)
|
|||||||
(xdrproc_t) xdr_void, (char *) NULL) == -1)
|
(xdrproc_t) xdr_void, (char *) NULL) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Remove handle for remote events */
|
if (priv->eventFlushTimer >= 0) {
|
||||||
virEventRemoveHandle(priv->sock);
|
/* Remove timeout */
|
||||||
/* Remove timout */
|
|
||||||
virEventRemoveTimeout(priv->eventFlushTimer);
|
virEventRemoveTimeout(priv->eventFlushTimer);
|
||||||
|
/* Remove handle for remote events */
|
||||||
|
virEventRemoveHandle(priv->watch);
|
||||||
|
}
|
||||||
|
|
||||||
/* Close socket. */
|
/* Close socket. */
|
||||||
if (priv->uses_tls && priv->session) {
|
if (priv->uses_tls && priv->session) {
|
||||||
@ -4483,6 +4486,10 @@ static int remoteDomainEventRegister (virConnectPtr conn,
|
|||||||
{
|
{
|
||||||
struct private_data *priv = conn->privateData;
|
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,
|
if (virDomainEventCallbackListAdd(conn, priv->callbackList,
|
||||||
callback, opaque, freecb) < 0) {
|
callback, opaque, freecb) < 0) {
|
||||||
error (conn, VIR_ERR_RPC, _("adding cb to list"));
|
error (conn, VIR_ERR_RPC, _("adding cb to list"));
|
||||||
|
Loading…
Reference in New Issue
Block a user