qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PULL 13/41] vhost-user: disconnect on HUP


From: Michael S. Tsirkin
Subject: [Qemu-devel] [PULL 13/41] vhost-user: disconnect on HUP
Date: Fri, 29 Jul 2016 06:15:51 +0300

From: Marc-André Lureau <address@hidden>

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é Lureau <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
 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 *chan, 
GIOCondition cond,
                                            void *opaque)
 {
     VhostUserState *s = opaque;
-    uint8_t buf[1];
 
-    /* We don't actually want to read anything, but CHR_EVENT_CLOSED will be
-     * raised as a side-effect of the read.
-     */
-    qemu_chr_fe_read_all(s->chr, buf, sizeof(buf));
+    qemu_chr_disconnect(s->chr);
 
     return FALSE;
 }
-- 
MST




reply via email to

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