qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qemu-char: Do not disconnect when there's data


From: Zifei Tong
Subject: Re: [Qemu-devel] [PATCH] qemu-char: Do not disconnect when there's data for reading
Date: Tue, 16 Sep 2014 15:04:54 +0800

On Tue, Sep 16, 2014 at 2:06 PM, Markus Armbruster <address@hidden> wrote:
> Cc'ing Gerd for additional chardev expertise.
>
> Zifei Tong <address@hidden> writes:
>
>> After commit 812c1057f6175ac9a9829fa2920a2b5783814193 (Handle G_IO_HUP
>> in tcp_chr_read for tcp chardev), the connection is disconnected when in
>> G_IO_HUP condition.
>>
>> However, it's possible that the channel is in G_IO_IN condition at the
>> same time, meaning there is data for reading. In that case, the
>> remaining data is not handled.
>>
>> I saw a related bug when running socat in write-only mode, with
>>
>>   $ echo "quit" | socat -u - UNIX-CONNECT:qemu-monitor
>>
>> the monitor won't not run the 'quit' command.
>
> Reproduced.
>
> Is this a regression caused by command 812c105?

The first bad commit is cdaa86 ("Add G_IO_HUP handler for socket
chardev"), which is reverted and reimplemented by 812c105.

>> CC: Kirill Batuzov <address@hidden>
>> CC: Nikolay Nikolaev <address@hidden>
>> CC: Anthony Liguori <address@hidden>
>> Signed-off-by: Zifei Tong <address@hidden>
>> ---
>>  qemu-char.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/qemu-char.c b/qemu-char.c
>> index 1a8d9aa..5018c3a 100644
>> --- a/qemu-char.c
>> +++ b/qemu-char.c
>> @@ -2706,7 +2706,7 @@ static gboolean tcp_chr_read(GIOChannel *chan, 
>> GIOCondition cond, void *opaque)
>>      uint8_t buf[READ_BUF_LEN];
>>      int len, size;
>>
>> -    if (cond & G_IO_HUP) {
>> +    if (!(cond & G_IO_IN) && (cond & G_IO_HUP)) {
>>          /* connection closed */
>>          tcp_chr_disconnect(chr);
>>          return TRUE;
>
> Kirill, you added the code being changed.  Could you review the patch?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]