Received: from eggs.gnu.org ([2001:4830:134:3::10]:59851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bS9hY-0002DQ-PL for qemu-devel@nongnu.org; Tue, 26 Jul 2016 17:15:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bS9hX-00028C-AM for qemu-devel@nongnu.org; Tue, 26 Jul 2016 17:15:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45347) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bS9hW-000287-V0 for qemu-devel@nongnu.org; Tue, 26 Jul 2016 17:15:43 -0400 From: marcandre.lureau@redhat.com Date: Wed, 27 Jul 2016 01:14:57 +0400 Message-Id: <20160726211527.28510-4-marcandre.lureau@redhat.com> In-Reply-To: <20160726211527.28510-1-marcandre.lureau@redhat.com> References: <20160726211527.28510-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v6 03/33] vhost-user: disconnect on HUP List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mukawa@igel.co.jp, yuanhan.liu@linux.intel.com, victork@redhat.com, jonshin@cisco.com, mst@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= From: Marc-Andr=C3=A9 Lureau In some cases, qemu_chr_fe_read_all() on HUP event doesn't raise CHR_EVENT_CLOSED because the read/recv function returns -1 on disconnected peers (for example with tch_chr_recv, an ECONNRESET errno overwritten as EIO). It is simpler to explicitely disconnect on HUP, rising CHR_EVENT_CLOSED if it wasn't disconnected already. Signed-off-by: Marc-Andr=C3=A9 Lureau --- net/vhost-user.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/net/vhost-user.c b/net/vhost-user.c index 2af212b..2cac32e 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -188,12 +188,8 @@ static gboolean net_vhost_user_watch(GIOChannel *cha= n, GIOCondition cond, void *opaque) { VhostUserState *s =3D opaque; - uint8_t buf[1]; =20 - /* We don't actually want to read anything, but CHR_EVENT_CLOSED wil= l be - * raised as a side-effect of the read. - */ - qemu_chr_fe_read_all(s->chr, buf, sizeof(buf)); + qemu_chr_disconnect(s->chr); =20 return FALSE; } --=20 2.9.0