From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39367) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSyHE-0005Vg-OM for qemu-devel@nongnu.org; Thu, 28 Jul 2016 23:16:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSyHC-0002qx-Pr for qemu-devel@nongnu.org; Thu, 28 Jul 2016 23:15:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46490) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSyHC-0002qt-Cx for qemu-devel@nongnu.org; Thu, 28 Jul 2016 23:15:54 -0400 Date: Fri, 29 Jul 2016 06:15:51 +0300 From: "Michael S. Tsirkin" Message-ID: <1469762011-7902-14-git-send-email-mst@redhat.com> References: <1469762011-7902-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1469762011-7902-1-git-send-email-mst@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 13/41] vhost-user: disconnect on HUP List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , =?iso-8859-1?Q?Marc-Andr=E9?= Lureau , Jason Wang From: Marc-Andr=E9 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=E9 Lureau Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- 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 MST