virNetServerClose and virNetServerShutdownWait are used to start net server
threads shutdown and wait net server threads to actually finish respectively
during net daemon shutdown procedure.
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy(a)virtuozzo.com>
Reviewed-by: Daniel P. Berrangé <berrange(a)redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413(a)gmail.com>
---
src/rpc/virnetserver.c | 8 ++++++++
src/rpc/virnetserver.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index e0a2386..79ea9f6 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -942,9 +942,17 @@ void virNetServerClose(virNetServerPtr srv)
for (i = 0; i < srv->nclients; i++)
virNetServerClientClose(srv->clients[i]);
+ virThreadPoolStop(srv->workers);
+
virObjectUnlock(srv);
}
+void
+virNetServerShutdownWait(virNetServerPtr srv)
+{
+ virThreadPoolDrain(srv->workers);
+}
+
static inline size_t
virNetServerTrackPendingAuthLocked(virNetServerPtr srv)
{
diff --git a/src/rpc/virnetserver.h b/src/rpc/virnetserver.h
index 1c6a2ef..112a51d 100644
--- a/src/rpc/virnetserver.h
+++ b/src/rpc/virnetserver.h
@@ -56,6 +56,7 @@ virNetServerPtr virNetServerNewPostExecRestart(virJSONValuePtr object,
ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5) ATTRIBUTE_NONNULL(6);
void virNetServerClose(virNetServerPtr srv);
+void virNetServerShutdownWait(virNetServerPtr srv);
virJSONValuePtr virNetServerPreExecRestart(virNetServerPtr srv);
--
1.8.3.1