[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 2/8] io: introduce a network socket listener API
From: |
Daniel P. Berrange |
Subject: |
Re: [Qemu-block] [PATCH 2/8] io: introduce a network socket listener API |
Date: |
Fri, 11 Aug 2017 13:48:21 +0100 |
User-agent: |
Mutt/1.8.3 (2017-05-23) |
On Fri, Aug 11, 2017 at 01:39:43PM +0100, Dr. David Alan Gilbert wrote:
> * Daniel P. Berrange (address@hidden) wrote:
> > On Fri, Aug 11, 2017 at 01:26:00PM +0100, Dr. David Alan Gilbert wrote:
> > > * Daniel P. Berrange (address@hidden) wrote:
> > > > The existing QIOChannelSocket class provides the ability to
> > > > listen on a single socket at a time. This patch introduces
> > > > a QIONetListener class that provides a higher level API
> > > > concept around listening for network services, allowing
> > > > for listening on multiple sockets.
> > >
> > > What protects against a connection on more than one of the sockets?
> >
> > That's not the responsibility of this module. If a backend only
> > wants to allow a single client at a time, it has to unregister
> > the new client callback and re-register when it is ready to
> > accept a new client. This aspect is no different to the existing
> > case of multiple clients connecting to a single listener socket.
>
> OK, and we guarantee that we never call accept() twice because we
> make sure we do that unregister before we get back to the main loop?
Yes, and even if 2 clients arrive at exactly the same time, and thus
both sockets show G_IO_IN on the same iteration of the main loop,
we check whether the new client callback is NULL, and so will just
drop the 2nd client.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
[Qemu-block] [PATCH 3/8] blockdev: convert internal NBD server to QIONetListener, Daniel P. Berrange, 2017/08/10
[Qemu-block] [PATCH 4/8] blockdev: convert qemu-nbd server to QIONetListener, Daniel P. Berrange, 2017/08/10
[Qemu-block] [PATCH 5/8] migration: convert socket server to QIONetListener, Daniel P. Berrange, 2017/08/10
[Qemu-block] [PATCH 6/8] chardev: convert the socket server to QIONetListener, Daniel P. Berrange, 2017/08/10
[Qemu-block] [PATCH 7/8] ui: convert VNC server to QIONetListener, Daniel P. Berrange, 2017/08/10
[Qemu-block] [PATCH 8/8] sockets: fix parsing of ipv4/ipv6 opts in parse_socket_addr, Daniel P. Berrange, 2017/08/10