Rev 213: report number of clients in ping in
http://samba.org/~tridge/ctdb
tridge at samba.org
tridge at samba.org
Sat Apr 28 13:15:21 GMT 2007
------------------------------------------------------------
revno: 213
revision-id: tridge at samba.org-20070428131521-53ws6e7u06s1llsm
parent: tridge at samba.org-20070428110259-azfdeu63sz5zb2xw
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Sat 2007-04-28 15:15:21 +0200
message:
report number of clients in ping
modified:
common/ctdb_client.c ctdb_client.c-20070411010216-3kd8v37k61steeya-1
common/ctdb_control.c ctdb_control.c-20070426122724-j6gkpiofhbwdin63-1
common/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1
include/ctdb_private.h ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13
tools/ctdb_control.c ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1
=== modified file 'common/ctdb_client.c'
--- a/common/ctdb_client.c 2007-04-28 11:02:59 +0000
+++ b/common/ctdb_client.c 2007-04-28 13:15:21 +0000
@@ -897,7 +897,7 @@
}
/*
- 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 @@
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;
}
/*
=== modified file 'common/ctdb_control.c'
--- a/common/ctdb_control.c 2007-04-28 10:40:26 +0000
+++ b/common/ctdb_control.c 2007-04-28 13:15:21 +0000
@@ -176,7 +176,7 @@
case CTDB_CONTROL_PING:
CHECK_CONTROL_DATA_SIZE(0);
- return 0;
+ return ctdb->num_clients;
case CTDB_CONTROL_GETDBPATH: {
uint32_t db_id;
=== modified file 'common/ctdb_daemon.c'
--- a/common/ctdb_daemon.c 2007-04-28 11:02:59 +0000
+++ b/common/ctdb_daemon.c 2007-04-28 13:15:21 +0000
@@ -232,6 +232,7 @@
*/
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 @@
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);
=== modified file 'include/ctdb_private.h'
--- a/include/ctdb_private.h 2007-04-28 10:40:26 +0000
+++ b/include/ctdb_private.h 2007-04-28 13:15:21 +0000
@@ -195,6 +195,7 @@
struct ctdb_daemon_data daemon;
struct ctdb_status status;
struct ctdb_vnn_map *vnn_map;
+ uint32_t num_clients;
};
struct ctdb_db_context {
=== modified file 'tools/ctdb_control.c'
--- a/tools/ctdb_control.c 2007-04-28 10:42:42 +0000
+++ b/tools/ctdb_control.c 2007-04-28 13:15:21 +0000
@@ -261,11 +261,11 @@
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;
More information about the samba-cvs
mailing list