From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWAAC-0006xH-Ix for qemu-devel@nongnu.org; Mon, 22 Sep 2014 16:24:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XWAA8-0005Fe-FA for qemu-devel@nongnu.org; Mon, 22 Sep 2014 16:24:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42862) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWAA8-0005F3-7R for qemu-devel@nongnu.org; Mon, 22 Sep 2014 16:24:44 -0400 Message-ID: <5420857C.8050504@redhat.com> Date: Mon, 22 Sep 2014 14:24:28 -0600 From: Eric Blake MIME-Version: 1.0 References: <1411340664-26912-1-git-send-email-minyard@acm.org> <1411340664-26912-6-git-send-email-minyard@acm.org> In-Reply-To: <1411340664-26912-6-git-send-email-minyard@acm.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Pl3HDilEf83LkF0vfSoB2xkrPJnWHBwS5" Subject: Re: [Qemu-devel] [PATCH 5/6] qemu-char: Add reconnecting to client sockets List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: minyard@acm.org, qemu-devel@nongnu.org Cc: mjg59@srcf.ucam.org, mst@redhat.com, hwd@huawei.com, bcketchum@gmail.com, Corey Minyard , afaerber@suse.de This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Pl3HDilEf83LkF0vfSoB2xkrPJnWHBwS5 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/21/2014 05:04 PM, minyard@acm.org wrote: > From: Corey Minyard >=20 > Adds a "reconnect" option to socket backends that gives a reconnect > timeout. This only applies to client sockets. If the other end > of a socket closes the connection, qemu will attempt to reconnect > after the given number of seconds. >=20 > Signed-off-by: Corey Minyard > --- > qapi-schema.json | 14 +++++---- > qemu-char.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++= ++++---- > qemu-options.hx | 20 ++++++++----- > 3 files changed, 106 insertions(+), 17 deletions(-) >=20 > diff --git a/qapi-schema.json b/qapi-schema.json > index 689b548..79f7a07 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -2648,14 +2648,18 @@ > # @nodelay: #optional set TCP_NODELAY socket option (default: false) > # @telnet: #optional enable telnet protocol on server > # sockets (default: false) > +# @reconnect: #optional If not a server socket, if the socket disconne= ct Awkward. How about: For a client socket, if a disconnect is detected, > +# then reconnect after the given number of seconds. Setting > +# to zero disables this function. (default: 0). Since: 2.2. I think this is usually written "(Since 2.2)" rather than "Since: 2.2" when it occurs in the middle of a single option. > # > # Since: 1.4 > ## > -{ 'type': 'ChardevSocket', 'data': { 'addr' : 'SocketAddress', > - '*server' : 'bool', > - '*wait' : 'bool', > - '*nodelay' : 'bool', > - '*telnet' : 'bool' } } > +{ 'type': 'ChardevSocket', 'data': { 'addr' : 'SocketAddress', > + '*server' : 'bool', > + '*wait' : 'bool', > + '*nodelay' : 'bool', > + '*telnet' : 'bool', > + '*reconnect' : 'int' } } Hmm, thinking aloud here. What happens if 'reconnect' is provided with a 'server':true socket? The documentation only specifies 'server':false behavior. Should it be an error (incompatible options), or just be silently ignored? Going further, would it be possible to treat 'ChardevSocket' as a flat union, where 'server' is the enum key that determines what other fields are valid? Granted, for this to work, we'd need to teach the qapi generator to allow a discriminator of type bool (since we can enumerate all of its values). looking something like: { 'type': 'ChardevSocketBase', 'data': { 'addr': 'SocketAddress', '*nodelay': 'bool' } } { 'type': 'ChardevSocketServer', 'data': { '*wait': 'bool', '*telnet': 'bool' } } { 'type': 'ChardevSocketClient', 'data': { '*reconnect': 'int' } } { 'union': 'ChardevSocket', 'base': 'ChardevSocketBase', 'discriminator': 'bool', 'data': { true : 'ChardevSocketServer', false: 'ChardevSocketClient' } } but I don't know if it is worth the complexity for the added type safety.= --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Pl3HDilEf83LkF0vfSoB2xkrPJnWHBwS5 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJUIIV8AAoJEKeha0olJ0NqomUH/39qO30K257uoCOGbR8uWtvL DvQEoDEMq8EGsDlZ6PfwU16lyLo63uylKR/oJCvxp/dsvzpb4vIppU6HBrOWf+y1 fJa0QHO2qBCnU9ic5AmXCb80fj/uRx38Xkhxg97T5dlo/TCn9eteKzwYeW0gZvU6 QEX98KBrKfMeOLZjXWEipqh9tkVKY9oL/tElX/tGOKeErEI4lQHdaK8HChffHyBb H8rFbJDGm2njrM2+fPlMtv+BdGtERBb3oB1yKwNC3+brKyCPdnq64EvDrK6a9WIn AteIXaRbER0GhkB21zL8pJrMAopVO2lONzG6bDCjXN/l6ziZJPtRH79ctLJbtqU= =bi6H -----END PGP SIGNATURE----- --Pl3HDilEf83LkF0vfSoB2xkrPJnWHBwS5--