Re: [PATCH v2 4/5] Update remote driver to support the connection close callbacks

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

 



On Thu, Jul 26, 2012 at 03:23:48PM +0200, Jiri Denemark wrote:
> On Tue, Jul 24, 2012 at 14:17:04 +0100, Daniel P. Berrange wrote:
> > From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> > 
> > Update the remote driver to use the virNetClient close callback
> > to trigger the virConnectPtr close callbacks
> > 
> > Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> > ---
> >  src/remote/remote_driver.c |   18 ++++++++++++++++++
> >  1 file changed, 18 insertions(+)
> > 
> > diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
> > index a69e69a..d41be55 100644
> > --- a/src/remote/remote_driver.c
> > +++ b/src/remote/remote_driver.c
> > @@ -320,6 +320,19 @@ enum virDrvOpenRemoteFlags {
> >  };
> >  
> >  
> > +static void remoteClientCloseFunc(virNetClientPtr client ATTRIBUTE_UNUSED,
> > +                                  int reason,
> > +                                  void *opaque)
> > +{
> > +    virConnectPtr conn = opaque;
> > +
> > +    if (conn->closeCallback) {
> > +        VIR_DEBUG("Triggering connection close callback %p reason=%d",
> > +                  conn->closeCallback, reason);
> > +        conn->closeCallback(conn, reason, conn->closeOpaque);
> > +    }
> > +}
> > +
> 
> Hmm, should we lock conn first to avoid possible race condition with
> virConnectUnregisterCloseCallback()?

Yes, that's a good point.


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 :|

--
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]