summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-12-01 08:58:08 +1100
committerAndrew Tridgell <tridge@samba.org>2006-12-01 08:58:08 +1100
commit375eeb8a245071c0aacda2c2ef53f31c6587eff3 (patch)
treedea7c5b9cb3d96baf5f97c5567db825fe10ed6b3
parentc6e9ec51669d41e38fb8a1e50df1f5be04ce906f (diff)
added ctdb_connect_wait()
(This used to be ctdb commit 0a033f04bbc17db1aaa3a4458149e1e6b055cb9a)
-rw-r--r--ctdb/common/ctdb.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/ctdb/common/ctdb.c b/ctdb/common/ctdb.c
index 6ab4b16702..1ab1f8ab86 100644
--- a/ctdb/common/ctdb.c
+++ b/ctdb/common/ctdb.c
@@ -157,7 +157,9 @@ static void ctdb_recv_pkt(struct ctdb_context *ctdb, uint8_t *data, uint32_t len
*/
static void ctdb_node_dead(struct ctdb_node *node)
{
- printf("%s: node %s is dead\n", node->ctdb->name, node->name);
+ node->ctdb->num_connected--;
+ printf("%s: node %s is dead: %d connected\n",
+ node->ctdb->name, node->name, node->ctdb->num_connected);
}
/*
@@ -165,7 +167,19 @@ static void ctdb_node_dead(struct ctdb_node *node)
*/
static void ctdb_node_connected(struct ctdb_node *node)
{
- printf("%s: connected to %s\n", node->ctdb->name, node->name);
+ node->ctdb->num_connected++;
+ printf("%s: connected to %s - %d connected\n",
+ node->ctdb->name, node->name, node->ctdb->num_connected);
+}
+
+/*
+ wait for all nodes to be connected
+*/
+void ctdb_connect_wait(struct ctdb_context *ctdb)
+{
+ while (ctdb->num_connected != ctdb->num_nodes - 1) {
+ event_loop_once(ctdb->ev);
+ }
}
static const struct ctdb_upcalls ctdb_upcalls = {