提交 6541a2b4 编写于 作者: M Martin Kletzander

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=1315606Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
上级 cd0a980e
...@@ -849,15 +849,23 @@ virNetDaemonClose(virNetDaemonPtr dmn) ...@@ -849,15 +849,23 @@ virNetDaemonClose(virNetDaemonPtr dmn)
static int static int
daemonServerHasClients(void *payload, daemonServerHasClients(void *payload,
const void *key ATTRIBUTE_UNUSED, const void *key ATTRIBUTE_UNUSED,
void *opaque ATTRIBUTE_UNUSED) void *opaque)
{ {
bool *clients = opaque;
virNetServerPtr srv = payload; virNetServerPtr srv = payload;
return virNetServerHasClients(srv); if (virNetServerHasClients(srv))
*clients = true;
return 0;
} }
bool bool
virNetDaemonHasClients(virNetDaemonPtr dmn) virNetDaemonHasClients(virNetDaemonPtr dmn)
{ {
return virHashForEach(dmn->servers, daemonServerHasClients, NULL) > 0; bool ret = false;
virHashForEach(dmn->servers, daemonServerHasClients, &ret);
return ret;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册