qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 6/8] ui: let VNC server listen on all resolved I


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 6/8] ui: let VNC server listen on all resolved IP addresses
Date: Fri, 6 Jan 2017 10:14:10 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0

On 01/05/2017 10:06 AM, Daniel P. Berrange wrote:
> Remove the limitation that the VNC server can only listen on
> a single resolved IP address. This uses the new DNS resolver
> API to resolve a SocketAddress struct into an array of
> SocketAddress structs containing raw IP addresses. The VNC
> server will then attempt to listen on all resolve IP addresses.

s/resolve/resolved/

> An error will be returned if it was not possible to listen on
> all of the IP addresses.

s/all/any/ ?  That is, we fail only if we don't get at least one working
listener, or do we fail if even one listener fails while the other work?

> 
> Signed-off-by: Daniel P. Berrange <address@hidden>
> ---
>  ui/vnc.c | 52 +++++++++++++++++++++++++++++++++++++++++++---------
>  1 file changed, 43 insertions(+), 9 deletions(-)
> 

> -    (*lsock_tag)[0] = qio_channel_add_watch(
> -        QIO_CHANNEL((*lsock)[0]),
> -        G_IO_IN, vnc_listen_io, vd, NULL);
> +    for (i = 0; i < nrawaddrs; i++) {
> +        QIOChannelSocket *sioc = qio_channel_socket_new();
> +
> +        qio_channel_set_name(QIO_CHANNEL(sioc), name);
> +        if (qio_channel_socket_listen_sync(
> +                sioc, rawaddrs[i], listenerr == NULL ? &listenerr : NULL) < 
> 0) {
> +            continue;
> +        }
> +        (*nlsock)++;
> +        *lsock = g_renew(QIOChannelSocket *, *lsock, *nlsock);
> +        *lsock_tag = g_renew(guint, *lsock_tag, *nlsock);
> +
> +        (*lsock)[*nlsock - 1] = sioc;
> +        (*lsock_tag)[*nlsock - 1] = 0;
> +    }
> +
> +    for (i = 0; i < nrawaddrs; i++) {
> +        qapi_free_SocketAddress(rawaddrs[i]);
> +    }
> +    g_free(rawaddrs);
> +
> +    if (listenerr) {
> +        if (*nlsock == 0) {
> +            error_propagate(errp, listenerr);
> +            return -1;
> +        } else {
> +            error_free(listenerr);
> +        }
> +    }

Answering my question - you fail only if ALL resolved addresses fail. If
at least one succeeds, the overall function succeeds.

With the commit message improved,
Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]