1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

show number of connected clients in status output

(This used to be ctdb commit 99765bbe327bfe9c43415f4943281458f25be51b)
This commit is contained in:
Andrew Tridgell 2007-05-05 14:09:46 +10:00
parent 410d41480a
commit 9636c97c5a
4 changed files with 5 additions and 3 deletions

View 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;

View 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);

View 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;

View 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),