]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
show number of connected clients in status output
authorAndrew Tridgell <tridge@samba.org>
Sat, 5 May 2007 04:09:46 +0000 (14:09 +1000)
committerAndrew Tridgell <tridge@samba.org>
Sat, 5 May 2007 04:09:46 +0000 (14:09 +1000)
(This used to be ctdb commit 99765bbe327bfe9c43415f4943281458f25be51b)

ctdb/common/ctdb_control.c
ctdb/common/ctdb_daemon.c
ctdb/include/ctdb_private.h
ctdb/tools/ctdb_control.c

index 2422ff945f6e758da7cb89b01bdf434434ffb1f6..dd6258713bea842ab17e887e5c1da0f87e780ca6 100644 (file)
@@ -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;
index f29d7d3c1225aaed2076e9e0785f4fa87034349f..616a7bc4b3d6441d51c602bdc34e55c2fcbddd93 100644 (file)
@@ -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);
index 81cf60f1cfc83c66fb4094f3a8f983477099d7c4..955755c679963b9c53aa58a3bb6e81b618cca6a4 100644 (file)
@@ -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;
index 3f5d369b6858f52911c70b8ed8ff9bd1c14f6719..6f74b1aa7f1b0dfa1ab625e008a7d08f44f855e4 100644 (file)
@@ -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),