mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
report number of clients in ping
(This used to be ctdb commit 9deaa1892faa8288cad9f6fde20d2aa8ba8af699)
This commit is contained in:
parent
2e77ee8f4d
commit
e6d5848a20
@ -897,7 +897,7 @@ int ctdb_setvnnmap(struct ctdb_context *ctdb, uint32_t destnode, struct ctdb_vnn
|
||||
}
|
||||
|
||||
/*
|
||||
ping a node
|
||||
ping a node, return number of clients connected
|
||||
*/
|
||||
int ctdb_ping(struct ctdb_context *ctdb, uint32_t destnode)
|
||||
{
|
||||
@ -907,10 +907,10 @@ int ctdb_ping(struct ctdb_context *ctdb, uint32_t destnode)
|
||||
|
||||
ZERO_STRUCT(data);
|
||||
ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_PING, data, NULL, NULL, &res);
|
||||
if (ret != 0 || res != 0) {
|
||||
if (ret != 0) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -176,7 +176,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
|
||||
|
||||
case CTDB_CONTROL_PING:
|
||||
CHECK_CONTROL_DATA_SIZE(0);
|
||||
return 0;
|
||||
return ctdb->num_clients;
|
||||
|
||||
case CTDB_CONTROL_GETDBPATH: {
|
||||
uint32_t db_id;
|
||||
|
@ -232,6 +232,7 @@ static void daemon_request_connect_wait(struct ctdb_client *client,
|
||||
*/
|
||||
static int ctdb_client_destructor(struct ctdb_client *client)
|
||||
{
|
||||
client->ctdb->num_clients--;
|
||||
close(client->fd);
|
||||
client->fd = -1;
|
||||
return 0;
|
||||
@ -547,6 +548,7 @@ static void ctdb_accept_client(struct event_context *ev, struct fd_event *fde,
|
||||
client = talloc_zero(ctdb, struct ctdb_client);
|
||||
client->ctdb = ctdb;
|
||||
client->fd = fd;
|
||||
ctdb->num_clients++;
|
||||
|
||||
client->queue = ctdb_queue_setup(ctdb, client, fd, CTDB_DS_ALIGNMENT,
|
||||
ctdb_daemon_read_cb, client);
|
||||
|
@ -195,6 +195,7 @@ struct ctdb_context {
|
||||
struct ctdb_daemon_data daemon;
|
||||
struct ctdb_status status;
|
||||
struct ctdb_vnn_map *vnn_map;
|
||||
uint32_t num_clients;
|
||||
};
|
||||
|
||||
struct ctdb_db_context {
|
||||
|
@ -261,11 +261,11 @@ static int control_ping(struct ctdb_context *ctdb, int argc, const char **argv)
|
||||
for (i=0;i<ctdb->num_nodes;i++) {
|
||||
struct timeval tv = timeval_current();
|
||||
ret = ctdb_ping(ctdb, i);
|
||||
if (ret != 0) {
|
||||
if (ret == -1) {
|
||||
printf("Unable to get ping response from node %u\n", i);
|
||||
} else {
|
||||
printf("response from %u time=%.6f sec\n",
|
||||
i, timeval_elapsed(&tv));
|
||||
printf("response from %u time=%.6f sec (%d clients)\n",
|
||||
i, timeval_elapsed(&tv), ret);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user