On 03/26/13 10:54, Viktor Mihajlovski wrote:
Before closing the connection we unregister the close callback
to prevent a reference leak. We make sure that we only unregister
if we have previously registered a callback (not the case for
virsh connect!). Further, the messages on virConnectClose != 0

In that case the callback should be registered also on "virsh connect" and also you did not unregister the callback there if you are changing from an active connection.


are a bit more specific now.

I like this change.


Signed-off-by: Viktor Mihajlovski <mihaj...@linux.vnet.ibm.com>
---
  tools/virsh.c |   23 +++++++++++++++++------
  1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index b574d7e..3c0b398 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -311,6 +311,8 @@ vshCatchDisconnect(virConnectPtr conn ATTRIBUTE_UNUSED,
          disconnected++;
  }

+static int callback_registered = 0;
+

When you actually register and unregister the callback in cmdConnect, you don't need to have this global variable. This change will need rearrangement of some code. I'll send the patch for this.

Peter


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

Reply via email to