From 9636c97c5a1ab55d3f1835e4a407af6c3722770b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 5 May 2007 14:09:46 +1000 Subject: [PATCH] show number of connected clients in status output (This used to be ctdb commit 99765bbe327bfe9c43415f4943281458f25be51b) --- ctdb/common/ctdb_control.c | 2 +- ctdb/common/ctdb_daemon.c | 4 ++-- ctdb/include/ctdb_private.h | 1 + ctdb/tools/ctdb_control.c | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ctdb/common/ctdb_control.c b/ctdb/common/ctdb_control.c index 2422ff945f6..dd6258713be 100644 --- a/ctdb/common/ctdb_control.c +++ b/ctdb/common/ctdb_control.c @@ -359,7 +359,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb, case CTDB_CONTROL_PING: CHECK_CONTROL_DATA_SIZE(0); ctdb->status.controls.ping++; - return ctdb->num_clients; + return ctdb->status.num_clients; case CTDB_CONTROL_GET_DBNAME: { uint32_t db_id; diff --git a/ctdb/common/ctdb_daemon.c b/ctdb/common/ctdb_daemon.c index f29d7d3c122..616a7bc4b3d 100644 --- a/ctdb/common/ctdb_daemon.c +++ b/ctdb/common/ctdb_daemon.c @@ -248,7 +248,7 @@ static void daemon_request_connect_wait(struct ctdb_client *client, static int ctdb_client_destructor(struct ctdb_client *client) { ctdb_reqid_remove(client->ctdb, client->client_id); - client->ctdb->num_clients--; + client->ctdb->status.num_clients--; close(client->fd); client->fd = -1; return 0; @@ -559,7 +559,7 @@ static void ctdb_accept_client(struct event_context *ev, struct fd_event *fde, client->ctdb = ctdb; client->fd = fd; client->client_id = ctdb_reqid_new(ctdb, client); - ctdb->num_clients++; + ctdb->status.num_clients++; client->queue = ctdb_queue_setup(ctdb, client, fd, CTDB_DS_ALIGNMENT, ctdb_daemon_read_cb, client); diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index 81cf60f1cfc..955755c6799 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -131,6 +131,7 @@ struct ctdb_daemon_data { ctdb status information */ struct ctdb_status { + uint32_t num_clients; uint32_t client_packets_sent; uint32_t client_packets_recv; uint32_t node_packets_sent; diff --git a/ctdb/tools/ctdb_control.c b/ctdb/tools/ctdb_control.c index 3f5d369b685..6f74b1aa7f1 100644 --- a/ctdb/tools/ctdb_control.c +++ b/ctdb/tools/ctdb_control.c @@ -97,6 +97,7 @@ static void show_status(struct ctdb_status *s) uint32_t offset; } fields[] = { #define STATUS_FIELD(n) { #n, offsetof(struct ctdb_status, n) } + STATUS_FIELD(num_clients), STATUS_FIELD(client_packets_sent), STATUS_FIELD(client_packets_recv), STATUS_FIELD(node_packets_sent),