From 6541a2b4acd453ebbf10a4427f9ec4e794d3ba6d Mon Sep 17 00:00:00 2001 From: Martin Kletzander Date: Tue, 1 Mar 2016 15:42:32 +0100 Subject: [PATCH] daemon: Properly check for clients virHashForEach() returns 0 if everything went nice, so our session daemon was timing out even when there was a client connected. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1315606 Signed-off-by: Martin Kletzander --- src/rpc/virnetdaemon.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/rpc/virnetdaemon.c b/src/rpc/virnetdaemon.c index 8ddcd9badd..9181ad7c47 100644 --- a/src/rpc/virnetdaemon.c +++ b/src/rpc/virnetdaemon.c @@ -849,15 +849,23 @@ virNetDaemonClose(virNetDaemonPtr dmn) static int daemonServerHasClients(void *payload, const void *key ATTRIBUTE_UNUSED, - void *opaque ATTRIBUTE_UNUSED) + void *opaque) { + bool *clients = opaque; virNetServerPtr srv = payload; - return virNetServerHasClients(srv); + if (virNetServerHasClients(srv)) + *clients = true; + + return 0; } bool virNetDaemonHasClients(virNetDaemonPtr dmn) { - return virHashForEach(dmn->servers, daemonServerHasClients, NULL) > 0; + bool ret = false; + + virHashForEach(dmn->servers, daemonServerHasClients, &ret); + + return ret; } -- GitLab