From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38570) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWAby-0003aB-DC for qemu-devel@nongnu.org; Mon, 22 Sep 2014 16:53:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XWAbt-00048I-EU for qemu-devel@nongnu.org; Mon, 22 Sep 2014 16:53:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:62103) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWAbt-00047K-6X for qemu-devel@nongnu.org; Mon, 22 Sep 2014 16:53:25 -0400 Message-ID: <54208C30.6060504@redhat.com> Date: Mon, 22 Sep 2014 14:53:04 -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> <5420857C.8050504@redhat.com> <5420883E.6010303@acm.org> In-Reply-To: <5420883E.6010303@acm.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3KkEeIOOj5h55CGD3DlHxrToLejlexc7J" 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) --3KkEeIOOj5h55CGD3DlHxrToLejlexc7J Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/22/2014 02:36 PM, Corey Minyard wrote: >> 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? >=20 > I was going on the behavior of "telnet" and "wait", which are silently > ignored for client sockets. reconnect is silently ignored for server > sockets. I can live with that. >=20 >> Going further, would it be possible to treat 'ChardevSocket' as a flat= >> union, where 'server' is the enum key that determines what other field= s >> 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 enumerat= e >> 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' } } Of course, this is invalid JSON. In a JSON dictionary, the left side of any 'key':'value' pair must be a string, only the right side can be an arbitrary JSON type. So we'd have to spell out the stringized version 'true' and 'false' as the enum keys, which is all the more special casing to be added to the qapi generator. Lots of work for not too much benefit. >> >> but I don't know if it is worth the complexity for the added type safe= ty. >> >=20 > Doesn't seem terrible, but I'm not sure. You're welcome to try it if you're interested, but in just typing this email, I can already see it's not a beginner's project, so I'm not going to insist. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --3KkEeIOOj5h55CGD3DlHxrToLejlexc7J 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 iQEcBAEBCAAGBQJUIIwwAAoJEKeha0olJ0Nqt0kH/30aZebGto/BOtYhMZmFjPtQ AcqUZOA2yptESMPaWkt7CG9axM9RuoJ8/nC8IBlhNoIaXlWnXtbjim4zGYDASfut bSoovF71ICkuYkYLJZfs/lGTMy36JFuAXkcVN2h3amgBjk2FwQ+OKQtWvFgcrilj 2dOiGTUk2xRvmxREm+D1bT6pbb5yNEKv7KU7i6nUEuTcQO4zKhxXGe5YgoDyK4ab S2qG/1ISyTWNaNpH1OIiabsLsC+Te47B2m+FIfJrZ0/+ed5V+M4o6UNy0SObApOY PN/nOQAelFnxDhkVtQyW8sPRnbdpij+CCXb8XnUL2qrDk9ZGd1393dv4F2r75PY= =+bfP -----END PGP SIGNATURE----- --3KkEeIOOj5h55CGD3DlHxrToLejlexc7J--