qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: minyard@acm.org, qemu-devel@nongnu.org
Cc: mjg59@srcf.ucam.org, mst@redhat.com, hwd@huawei.com,
	bcketchum@gmail.com, Corey Minyard <cminyard@mvista.com>,
	afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH 5/6] qemu-char: Add reconnecting to client sockets
Date: Mon, 22 Sep 2014 14:53:04 -0600	[thread overview]
Message-ID: <54208C30.6060504@redhat.com> (raw)
In-Reply-To: <5420883E.6010303@acm.org>

[-- Attachment #1: Type: text/plain, Size: 2072 bytes --]

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?
> 
> 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.

> 
>> 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' } }

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 safety.
>>
> 
> 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.

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


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 539 bytes --]

  reply	other threads:[~2014-09-22 20:53 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-21 23:04 [Qemu-devel] [PATCH 0/6] Add reconnect capability for client sockets minyard
2014-09-21 23:04 ` [Qemu-devel] [PATCH 1/6] qemu-char: Make the filename size for a chardev a #define minyard
2014-09-22  7:46   ` Paolo Bonzini
2014-09-21 23:04 ` [Qemu-devel] [PATCH 2/6] qemu-char: Rework qemu_chr_open_socket() for reconnect minyard
2014-09-22  8:08   ` Paolo Bonzini
2014-09-21 23:04 ` [Qemu-devel] [PATCH 3/6] qemu-char: Move some items into TCPCharDriver minyard
2014-09-22  7:46   ` Paolo Bonzini
2014-09-21 23:04 ` [Qemu-devel] [PATCH 4/6] qemu-char: set socket filename to disconnected when not connected minyard
2014-09-22  8:06   ` Paolo Bonzini
2014-09-22 13:15     ` Corey Minyard
2014-09-22 13:25       ` Paolo Bonzini
2014-09-22 13:30         ` Corey Minyard
2014-09-22 13:39           ` Paolo Bonzini
2014-09-21 23:04 ` [Qemu-devel] [PATCH 5/6] qemu-char: Add reconnecting to client sockets minyard
2014-09-22  8:02   ` Paolo Bonzini
2014-09-22 20:24   ` Eric Blake
2014-09-22 20:36     ` Corey Minyard
2014-09-22 20:53       ` Eric Blake [this message]
2014-09-21 23:04 ` [Qemu-devel] [PATCH 6/6] qemu-char: Print the remote and local addresses for a socket minyard
2014-09-22  8:02   ` Paolo Bonzini
  -- strict thread matches above, loose matches on Subject: below --
2014-09-22 16:59 [Qemu-devel] [PATCH v2 0/6] chardev: Add reconnecting to client sockets minyard
2014-09-22 16:59 ` [Qemu-devel] [PATCH 5/6] qemu-char: " minyard
2014-09-22 20:26   ` Eric Blake
2014-09-25 20:07 [Qemu-devel] [PATCH v3 0/6] chardev: " minyard
2014-09-25 20:07 ` [Qemu-devel] [PATCH 5/6] qemu-char: " minyard
2014-10-01 12:38   ` Corey Minyard
2014-10-01 18:15     ` Paolo Bonzini
2014-10-01 19:10   ` Eric Blake
2014-10-01 21:03     ` Corey Minyard
2014-10-01 21:09 [Qemu-devel] [PATCH v4 0/6] Add reconnect capability to sockets minyard
2014-10-01 21:09 ` [Qemu-devel] [PATCH 5/6] qemu-char: Add reconnecting to client sockets minyard
2014-10-02 12:25   ` Paolo Bonzini
2014-10-02 16:17 [Qemu-devel] [PATCH v5 0/6] " minyard
2014-10-02 16:17 ` [Qemu-devel] [PATCH 5/6] qemu-char: " minyard
2014-10-03 22:22   ` Paolo Bonzini
2014-10-04  3:24     ` Corey Minyard
2014-10-04 15:54       ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54208C30.6060504@redhat.com \
    --to=eblake@redhat.com \
    --cc=afaerber@suse.de \
    --cc=bcketchum@gmail.com \
    --cc=cminyard@mvista.com \
    --cc=hwd@huawei.com \
    --cc=minyard@acm.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).