瀏覽代碼

vhost-user: disconnect on HUP

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 <marcandre.lureau@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Marc-André Lureau 9 年之前
父節點
當前提交
9c7d18b3a5
共有 1 個文件被更改,包括 1 次插入5 次删除
  1. 1 5
      net/vhost-user.c

+ 1 - 5
net/vhost-user.c

@@ -188,12 +188,8 @@ static gboolean net_vhost_user_watch(GIOChannel *chan, GIOCondition cond,
                                            void *opaque)
                                            void *opaque)
 {
 {
     VhostUserState *s = 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;
     return FALSE;
 }
 }