[PATCH v5 03/10] close callback: make unregister clean after connect close event

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If connect close is fired then following unregister will fail
as we set callback to NULL and thus callback equality checking
will fail.

Callback is set to NULL to make it fired only one time probabaly.
Instead lets use connection equality to NULL to check if callback
is already fired.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx>
---
 src/datatypes.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/datatypes.c b/src/datatypes.c
index a4ee2b8..e115a23 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -235,7 +235,7 @@ void virConnectCloseCallbackDataCall(virConnectCloseCallbackDataPtr close,
 {
     virObjectLock(close);
 
-    if (!close->callback)
+    if (!close->conn)
         goto exit;
 
     VIR_DEBUG("Triggering connection close callback %p reason=%d, opaque=%p",
@@ -244,7 +244,6 @@ void virConnectCloseCallbackDataCall(virConnectCloseCallbackDataPtr close,
 
     if (close->freeCallback)
         close->freeCallback(close->opaque);
-    close->callback = NULL;
     close->freeCallback = NULL;
     virObjectUnref(close->conn);
     close->conn = NULL;
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]