All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 3/8] ui: refactor VncDisplay to allow multiple listening sockets
Date: Fri, 6 Jan 2017 15:28:19 +0000	[thread overview]
Message-ID: <20170106152819.GP31112@redhat.com> (raw)
In-Reply-To: <b9fc5446-b9d9-cede-2b1a-b3012f904b8d@redhat.com>

On Fri, Jan 06, 2017 at 09:23:24AM -0600, Eric Blake wrote:
> On 01/05/2017 10:06 AM, Daniel P. Berrange wrote:
> > Currently there is only a single listener for plain VNC and
> > a single listener for websockets VNC. This means that is
> 
> s/is/if/
> 
> > getaddrinfo() returns multiple IP addresses, for a hostname,
> > the VNC server can only listen on one of them. This is
> > just bearable if listening on wildcard interface, or if
> > the host only has a single network interface to listen on,
> > but if there are multiple NICs and the VNC server needs
> > to listen on 2 or more specific IP addresses, it can't be
> > done.
> > 
> > This refactors the VncDisplay state so that it holds an
> > array of listening sockets, but still only listens on
> > one socket.
> > 
> > Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> > ---
> >  ui/vnc.c | 103 +++++++++++++++++++++++++++++++++++++++++----------------------
> >  ui/vnc.h |  10 ++++---
> >  2 files changed, 73 insertions(+), 40 deletions(-)
> 
> Are you using git's order directives to put .h files first?

No special git config at all.

> > @@ -3819,30 +3843,36 @@ void vnc_display_open(const char *id, Error **errp)
> >          vnc_connect(vd, sioc, false, false);
> >          object_unref(OBJECT(sioc));
> >      } else {
> > -        vd->lsock = qio_channel_socket_new();
> > -        qio_channel_set_name(QIO_CHANNEL(vd->lsock), "vnc-listen");
> > -        if (qio_channel_socket_listen_sync(vd->lsock, saddr, errp) < 0) {
> > +        vd->nlsock = 1;
> > +        vd->lsock = g_new0(QIOChannelSocket *, 1);
> > +        vd->lsock_tag = g_new0(guint, 1);
> 
> Is guint really the best type here...

Yep, guint is what the the Glib main loop uses as the type for
tracking GSource IDs. e.g.

https://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html#g-source-get-id

> 
> > +++ b/ui/vnc.h
> > @@ -146,10 +146,12 @@ struct VncDisplay
> >      int num_exclusive;
> >      int connections_limit;
> >      VncSharePolicy share_policy;
> > -    QIOChannelSocket *lsock;
> > -    guint lsock_tag;
> > -    QIOChannelSocket *lwebsock;
> > -    guint lwebsock_tag;
> > +    size_t nlsock;
> > +    QIOChannelSocket **lsock;
> > +    guint *lsock_tag;
> 
> ...and here?
> 
> > +    size_t nlwebsock;
> > +    QIOChannelSocket **lwebsock;
> > +    guint *lwebsock_tag;
> >      DisplaySurface *ds;
> >      DisplayChangeListener dcl;
> >      kbd_layout_t *kbd_layout;
> > 
> 
> Whether or not you tweak the types to something a little more direct (I
> thing guint is more hassle than it's worth when not directly passing the
> field to glib functions),

It'll be passed to g_source_remove later which expects guint

https://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html#g-source-remove

> Reviewed-by: Eric Blake <eblake@redhat.com>

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|

  reply	other threads:[~2017-01-06 15:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-05 16:06 [Qemu-devel] [PATCH 0/8] Support multiple listening sockets per VNC server Daniel P. Berrange
2017-01-05 16:06 ` [Qemu-devel] [PATCH 1/8] ui: fix regression handling bare 'websocket' option to -vnc Daniel P. Berrange
2017-01-06 13:39   ` Eric Blake
2017-01-05 16:06 ` [Qemu-devel] [PATCH 2/8] ui: fix reporting of VNC auth in query-vnc-servers Daniel P. Berrange
2017-01-06 15:06   ` Eric Blake
2017-01-05 16:06 ` [Qemu-devel] [PATCH 3/8] ui: refactor VncDisplay to allow multiple listening sockets Daniel P. Berrange
2017-01-06 15:23   ` Eric Blake
2017-01-06 15:28     ` Daniel P. Berrange [this message]
2017-01-05 16:06 ` [Qemu-devel] [PATCH 4/8] ui: refactor code for populating SocketAddress from vnc_display_open Daniel P. Berrange
2017-01-06 15:47   ` Eric Blake
2017-01-05 16:06 ` [Qemu-devel] [PATCH 5/8] ui: extract code to connect/listen " Daniel P. Berrange
2017-01-06 16:00   ` Eric Blake
2017-01-05 16:06 ` [Qemu-devel] [PATCH 6/8] ui: let VNC server listen on all resolved IP addresses Daniel P. Berrange
2017-01-06 16:14   ` Eric Blake
2017-01-05 16:07 ` [Qemu-devel] [PATCH 7/8] util: add qemu_opt_get_all() to get repeated opts Daniel P. Berrange
2017-01-06 16:22   ` Eric Blake
2017-01-05 16:07 ` [Qemu-devel] [PATCH 8/8] ui: add ability to specify multiple VNC listen addresses Daniel P. Berrange
2017-01-06 16:34   ` Eric Blake
2017-01-05 17:26 ` [Qemu-devel] [PATCH 0/8] Support multiple listening sockets per VNC server no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170106152819.GP31112@redhat.com \
    --to=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.