summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-lib/src/rpcsvc.c
diff options
context:
space:
mode:
Diffstat (limited to 'rpc/rpc-lib/src/rpcsvc.c')
-rw-r--r--rpc/rpc-lib/src/rpcsvc.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c
index 5717bedcf17..0a4dc04c731 100644
--- a/rpc/rpc-lib/src/rpcsvc.c
+++ b/rpc/rpc-lib/src/rpcsvc.c
@@ -2203,6 +2203,52 @@ rpcsvc_set_outstanding_rpc_limit (rpcsvc_t *svc, dict_t *options, int defvalue)
return (0);
}
+/*
+ * Enable throttling for rpcsvc_t svc.
+ * Returns 0 on success, -1 otherwise.
+ */
+int
+rpcsvc_set_throttle_on (rpcsvc_t *svc)
+{
+
+ if (!svc)
+ return -1;
+
+ svc->throttle = _gf_true;
+
+ return 0;
+}
+
+/*
+ * Disable throttling for rpcsvc_t svc.
+ * Returns 0 on success, -1 otherwise.
+ */
+int
+rpcsvc_set_throttle_off (rpcsvc_t *svc)
+{
+
+ if (!svc)
+ return -1;
+
+ svc->throttle = _gf_false;
+
+ return 0;
+}
+
+/*
+ * Get throttle state for rpcsvc_t svc.
+ * Returns value of attribute throttle on success, _gf_false otherwise.
+ */
+gf_boolean_t
+rpcsvc_get_throttle (rpcsvc_t *svc)
+{
+
+ if (!svc)
+ return _gf_false;
+
+ return svc->throttle;
+}
+
/* The global RPC service initializer.
*/
rpcsvc_t *