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 <berra...@redhat.com> > --- > 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 <ebl...@redhat.com> -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature