[libvirt] [PATCH 3/5] Add callback to virNetClient to be invoked on connection close

Daniel P. Berrange berrange at redhat.com
Fri Jul 20 14:18:17 UTC 2012


On Thu, Jul 19, 2012 at 11:57:17AM -0600, Eric Blake wrote:
> On 07/19/2012 09:04 AM, Daniel P. Berrange wrote:
> > From: "Daniel P. Berrange" <berrange at redhat.com>
> > 
> > Allow detection of socket close in virNetClient via an callback
> > function, triggered on any condition that causes the socket to
> > be close.
> > 
> > Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> > ---
> 
> > @@ -463,6 +480,9 @@ void virNetClientFree(virNetClientPtr client)
> >          return;
> >      }
> >  
> > +    if (client->closeFf && client->closeOpaque)
> > +        client->closeFf(client->closeOpaque);
> 
> Again, you should not be forcing closeOpaque to be non-NULL.  It's
> opaque, after all.

If opaque is NULL, then there's nothing that needs free'ing.

> > @@ -534,7 +561,7 @@ virNetClientCloseLocked(virNetClientPtr client)
> >  static void virNetClientCloseInternal(virNetClientPtr client,
> >                                        int reason)
> >  {
> > -    VIR_DEBUG("client=%p", client);
> > +    VIR_DEBUG("client=%p wantclose=%d", client, client ? client->wantClose : false);
> 
> Passing 'false' to %d looks odd, but works.  If, per my 2/5 comments,
> you merge wantClose into closeReason, then you'd have an int instead of
> a bool to print here.
> 
> ACK, once you fix the non-NULL opaque limitation.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list