From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34076) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZaob-0000AL-SD for qemu-devel@nongnu.org; Tue, 16 Aug 2016 05:37:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bZaoX-0003zn-Ma for qemu-devel@nongnu.org; Tue, 16 Aug 2016 05:37:44 -0400 Received: from mx4-phx2.redhat.com ([209.132.183.25]:53227) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZaoX-0003zc-F0 for qemu-devel@nongnu.org; Tue, 16 Aug 2016 05:37:41 -0400 Date: Tue, 16 Aug 2016 05:37:36 -0400 (EDT) From: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Message-ID: <1325593821.3014316.1471340256095.JavaMail.zimbra@redhat.com> In-Reply-To: <20160816093159.GB25115@redhat.com> References: <20160816083332.15088-1-marcandre.lureau@redhat.com> <20160816093159.GB25115@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH for-2.7] char: fix waiting for TLS and telnet connection List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , qemu-devel@nongnu.org, dl soluz Hi ----- Original Message ----- > On Tue, Aug 16, 2016 at 12:33:32PM +0400, Marc-Andr=C3=A9 Lureau wrote: > > Since commit d7a04fd7d5008, tcp_chr_wait_connected() was introduced, > > so vhost-user could wait until a backend started successfully. In > > vhost-user case, the chr socket must be plain unix, and the chr+vhost > > setup happens synchronously during qemu startup. > >=20 > > However, with TLS and telnet socket, initial socket setup happens > > asynchronously, and s->connected is not set after the socket is > > accepted. In order for tcp_chr_wait_connected() to not keep accepting > > new connections and proceed with the last accepted socket, it can > > check for s->ioc instead. > >=20 > > Signed-off-by: Marc-Andr=C3=A9 Lureau > > --- > > qemu-char.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > >=20 > > diff --git a/qemu-char.c b/qemu-char.c > > index 8a0ab05..5f82ebb 100644 > > --- a/qemu-char.c > > +++ b/qemu-char.c > > @@ -3176,7 +3176,9 @@ static int tcp_chr_wait_connected(CharDriverState > > *chr, Error **errp) > > TCPCharDriver *s =3D chr->opaque; > > QIOChannelSocket *sioc; > > =20 > > - while (!s->connected) { > > + /* It can't wait on s->connected, since it is set asynchronously > > + * in TLS and telnet cases, only wait for an accepted socket */ > > + while (!s->ioc) { > > if (s->is_listen) { > > fprintf(stderr, "QEMU waiting for connection on: %s\n", > > chr->filename); >=20 > Reviewed-by: Daniel P. Berrange >=20 > This is a definite must fix for 2.7.0. >=20 > Also shows we really badly need unit tests for the chardev stuff :-) That was my thought too :)