render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
6ae9ed
From a2d0e5b5b488ccf76fdfb696250259a767c3a904 Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <a2d0e5b5b488ccf76fdfb696250259a767c3a904@dist-git>
6ae9ed
From: Erik Skultety <eskultet@redhat.com>
6ae9ed
Date: Tue, 2 Aug 2016 15:20:51 +0200
6ae9ed
Subject: [PATCH] rpc: virnetserver: Move virNetServerCheckLimits which is
6ae9ed
 static up in the file
6ae9ed
6ae9ed
Since virNetServerAddClient checks for the limits in order to temporarily
6ae9ed
suspend the services, thus not accepting any more clients, there is no reason
6ae9ed
why virNetServerCheckLimits, which is only responsible for re-enabling
6ae9ed
previously disabled services according to the limits, could not do both. To be
6ae9ed
able to do that however, it needs to be moved up in the file since it's static
6ae9ed
(and because it's just a helper and there's only one caller it should remain
6ae9ed
 static).
6ae9ed
6ae9ed
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6ae9ed
(cherry picked from commit 17bc333411d290c0cc985664a388ff561c1a72f1)
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1357776
6ae9ed
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6ae9ed
---
6ae9ed
 src/rpc/virnetserver.c | 57 +++++++++++++++++++++++++-------------------------
6ae9ed
 1 file changed, 28 insertions(+), 29 deletions(-)
6ae9ed
6ae9ed
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
6ae9ed
index 13b5bd3..0c502d9 100644
6ae9ed
--- a/src/rpc/virnetserver.c
6ae9ed
+++ b/src/rpc/virnetserver.c
6ae9ed
@@ -234,6 +234,34 @@ static int virNetServerDispatchNewMessage(virNetServerClientPtr client,
6ae9ed
     return ret;
6ae9ed
 }
6ae9ed
 
6ae9ed
+/**
6ae9ed
+ * virNetServerCheckLimits:
6ae9ed
+ * @srv: server to check limits on
6ae9ed
+ *
6ae9ed
+ * Check if limits like max_clients or max_anonymous_clients
6ae9ed
+ * are satisfied and if so, re-enable accepting new clients.
6ae9ed
+ * The @srv must be locked when this function is called.
6ae9ed
+ */
6ae9ed
+static void
6ae9ed
+virNetServerCheckLimits(virNetServerPtr srv)
6ae9ed
+{
6ae9ed
+    /* Enable services if we can accept a new client.
6ae9ed
+     * The new client can be accepted if both max_clients and
6ae9ed
+     * max_anonymous_clients wouldn't get overcommitted by
6ae9ed
+     * accepting it. */
6ae9ed
+    VIR_DEBUG("Considering re-enabling services: "
6ae9ed
+              "nclients=%zu nclients_max=%zu "
6ae9ed
+              "nclients_unauth=%zu nclients_unauth_max=%zu",
6ae9ed
+              srv->nclients, srv->nclients_max,
6ae9ed
+              srv->nclients_unauth, srv->nclients_unauth_max);
6ae9ed
+    if (srv->nclients < srv->nclients_max &&
6ae9ed
+        (!srv->nclients_unauth_max ||
6ae9ed
+         srv->nclients_unauth < srv->nclients_unauth_max)) {
6ae9ed
+        /* Now it makes sense to accept() a new client. */
6ae9ed
+        VIR_INFO("Re-enabling services");
6ae9ed
+        virNetServerUpdateServicesLocked(srv, true);
6ae9ed
+    }
6ae9ed
+}
6ae9ed
 
6ae9ed
 int virNetServerAddClient(virNetServerPtr srv,
6ae9ed
                           virNetServerClientPtr client)
6ae9ed
@@ -737,35 +765,6 @@ void virNetServerUpdateServices(virNetServerPtr srv,
6ae9ed
     virObjectUnlock(srv);
6ae9ed
 }
6ae9ed
 
6ae9ed
-/**
6ae9ed
- * virNetServerCheckLimits:
6ae9ed
- * @srv: server to check limits on
6ae9ed
- *
6ae9ed
- * Check if limits like max_clients or max_anonymous_clients
6ae9ed
- * are satisfied and if so, re-enable accepting new clients.
6ae9ed
- * The @srv must be locked when this function is called.
6ae9ed
- */
6ae9ed
-static void
6ae9ed
-virNetServerCheckLimits(virNetServerPtr srv)
6ae9ed
-{
6ae9ed
-    /* Enable services if we can accept a new client.
6ae9ed
-     * The new client can be accepted if both max_clients and
6ae9ed
-     * max_anonymous_clients wouldn't get overcommitted by
6ae9ed
-     * accepting it. */
6ae9ed
-    VIR_DEBUG("Considering re-enabling services: "
6ae9ed
-              "nclients=%zu nclients_max=%zu "
6ae9ed
-              "nclients_unauth=%zu nclients_unauth_max=%zu",
6ae9ed
-              srv->nclients, srv->nclients_max,
6ae9ed
-              srv->nclients_unauth, srv->nclients_unauth_max);
6ae9ed
-    if (srv->nclients < srv->nclients_max &&
6ae9ed
-        (!srv->nclients_unauth_max ||
6ae9ed
-         srv->nclients_unauth < srv->nclients_unauth_max)) {
6ae9ed
-        /* Now it makes sense to accept() a new client. */
6ae9ed
-        VIR_INFO("Re-enabling services");
6ae9ed
-        virNetServerUpdateServicesLocked(srv, true);
6ae9ed
-    }
6ae9ed
-}
6ae9ed
-
6ae9ed
 void virNetServerDispose(void *obj)
6ae9ed
 {
6ae9ed
     virNetServerPtr srv = obj;
6ae9ed
-- 
6ae9ed
2.9.2
6ae9ed