summaryrefslogtreecommitdiffstats
path: root/src/server/rpc.c
diff options
context:
space:
mode:
authorSimon Rettberg2017-10-06 12:18:19 +0200
committerSimon Rettberg2017-10-06 12:18:19 +0200
commit0c4a63c894fb20eefe72a78789931fe02b6d8d18 (patch)
tree683b929f481e51559e80dca58938b6e8dcd75352 /src/server/rpc.c
parent[SERVER] rpc: Fix bitmask calc for odd subnet sizes (not 8, 16, ...) (diff)
downloaddnbd3-0c4a63c894fb20eefe72a78789931fe02b6d8d18.tar.gz
dnbd3-0c4a63c894fb20eefe72a78789931fe02b6d8d18.tar.xz
dnbd3-0c4a63c894fb20eefe72a78789931fe02b6d8d18.zip
[SERVER] Return client count when requesting stats but not client list
Diffstat (limited to 'src/server/rpc.c')
-rw-r--r--src/server/rpc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/server/rpc.c b/src/server/rpc.c
index 782c6b8..138e94b 100644
--- a/src/server/rpc.c
+++ b/src/server/rpc.c
@@ -122,7 +122,7 @@ static bool handleStatus(int sock, const char *request, int permissions)
// Call this first because it will update the total bytes sent counter
json_t *jsonClients = NULL;
if ( stats || clients ) {
- jsonClients = net_clientsToJson( permissions & ACL_CLIENT_LIST );
+ jsonClients = net_clientsToJson( clients );
}
const int uptime = dnbd3_serverUptime();
json_t *statisticsJson;
@@ -137,8 +137,12 @@ static bool handleStatus(int sock, const char *request, int permissions)
statisticsJson = json_pack( "{sI}",
"uptime", (json_int_t) uptime );
}
- if ( clients ) {
- json_object_set_new( statisticsJson, "clients", jsonClients );
+ if ( jsonClients != NULL ) {
+ if ( clients ) {
+ json_object_set_new( statisticsJson, "clients", jsonClients );
+ } else if ( stats ) {
+ json_object_set_new( statisticsJson, "clientCount", jsonClients );
+ }
}
if ( images ) {
json_object_set_new( statisticsJson, "images", image_getListAsJson() );