qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 23/24] vhost-user: wait until link is up


From: marcandre . lureau
Subject: [Qemu-devel] [PATCH 23/24] vhost-user: wait until link is up
Date: Tue, 21 Jun 2016 12:02:51 +0200

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

The chardev waits for an initial connection before starting qemu,
vhost-user wants the backend negotiation to be completed. vhost-user is
started in the net_vhost_user_event callback, which is synchronously
called after the socket is connected.

Signed-off-by: Marc-André Lureau <address@hidden>
---
 net/vhost-user.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/net/vhost-user.c b/net/vhost-user.c
index 95ed2d2..bb4a253 100644
--- a/net/vhost-user.c
+++ b/net/vhost-user.c
@@ -248,7 +248,15 @@ static int net_vhost_user_init(NetClientState *peer, const 
char *device,
         s->chr = chr;
     }
 
-    qemu_chr_add_handlers(chr, NULL, NULL, net_vhost_user_event, nc[0].name);
+    do {
+        Error *err = NULL;
+        if (qemu_chr_wait_connected(chr, &err) < 0) {
+            error_report_err(err);
+            return -1;
+        }
+        qemu_chr_add_handlers(chr, NULL, NULL,
+                              net_vhost_user_event, nc[0].name);
+    } while (nc->link_down);
 
     assert(s->vhost_net != NULL);
 
-- 
2.7.4




reply via email to

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