From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1yAS-0005FD-KI for qemu-devel@nongnu.org; Tue, 01 Jul 2014 09:32:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1yAM-0006v9-7m for qemu-devel@nongnu.org; Tue, 01 Jul 2014 09:32:16 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:50377 helo=socrates.bennee.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1yAL-0006th-Rn for qemu-devel@nongnu.org; Tue, 01 Jul 2014 09:32:10 -0400 References: <20140527120423.15172.36698.stgit@3820> <1404215552-12962-1-git-send-email-batuzovk@ispras.ru> From: Alex =?utf-8?Q?Benn=C3=A9e?= Date: Tue, 01 Jul 2014 14:29:01 +0100 In-reply-to: <1404215552-12962-1-git-send-email-batuzovk@ispras.ru> Message-ID: <87ionhp5ku.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH] Handle G_IO_HUP in tcp_chr_read for tcp chardev List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kirill Batuzov Cc: Antonios Motakis , Nikita Belov , qemu-devel@nongnu.org, Nikolay Nikolaev , "Michael S. Tsirkin" Kirill Batuzov writes: > Due to GLib limitations it is not possible to create several watches on one > channel on Windows hosts. See bug #338943 in GNOME bugzilla for details: > https://bugzilla.gnome.org/show_bug.cgi?id=338943 > > Handle G_IO_HUP in tcp_chr_read. It is already watched by corresponding watch. > Also remove the second watch with its handler. > > This reverts commit cdaa86a54b232572bba594bf87a7416e527e460c. > ("Add G_IO_HUP handler for socket chardev") but keeps its functionality. > --- a/qemu-char.c > +++ b/qemu-char.c > @@ -2673,6 +2673,12 @@ 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) { > + /* connection closed */ > + tcp_chr_disconnect(chr); > + return TRUE; > + } Is this right. AIUI we could return FALSE here to remove the watch for the now closed channel. -- Alex Bennée