From: Lei Li <lilei@linux.vnet.ibm.com>
To: Anthony Liguori <anthony@codemonkey.ws>, qemu-devel@nongnu.org
Cc: Lei Li <lilei@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH] qemu-char: (Re-)connect for tcp_chr_write() unconnected writing
Date: Mon, 06 Aug 2012 18:54:07 +0800 [thread overview]
Message-ID: <501FA24F.20106@linux.vnet.ibm.com> (raw)
In-Reply-To: <87394nbb72.fsf@codemonkey.ws>
Ping?
On 07/20/2012 07:09 AM, Anthony Liguori wrote:
> Lei Li <lilei@linux.vnet.ibm.com> writes:
>> tcp_chr_write() did not deal with writing to an unconnected
>> connection and return the original length of the data, it's
>> not right and would cause false writing. So (re-)connect it
>> and return 0 for this situation.
>>
>> Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
> Looks good.
>
> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
>
> Regards,
>
> Anthony Liguori
>
>> ---
>> qemu-char.c | 7 +++++--
>> 1 files changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/qemu-char.c b/qemu-char.c
>> index c2aaaee..25eaeeb 100644
>> --- a/qemu-char.c
>> +++ b/qemu-char.c
>> @@ -2141,14 +2141,17 @@ typedef struct {
>>
>> static void tcp_chr_accept(void *opaque);
>>
>> +static void tcp_chr_connect(void *opaque);
>> +
>> static int tcp_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
>> {
>> TCPCharDriver *s = chr->opaque;
>> if (s->connected) {
>> return send_all(s->fd, buf, len);
>> } else {
>> - /* XXX: indicate an error ? */
>> - return len;
>> + /* (Re-)connect for unconnected writing */
>> + tcp_chr_connect(chr);
>> + return 0;
>> }
>> }
>>
>> --
>> 1.7.7.6
--
Lei
next prev parent reply other threads:[~2012-08-06 10:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-19 14:09 [Qemu-devel] [PATCH] qemu-char: (Re-)connect for tcp_chr_write() unconnected writing Lei Li
2012-07-19 23:09 ` Anthony Liguori
2012-08-06 10:54 ` Lei Li [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-07-16 2:58 Lei Li
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=501FA24F.20106@linux.vnet.ibm.com \
--to=lilei@linux.vnet.ibm.com \
--cc=anthony@codemonkey.ws \
--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).