From: Andrew Tridgell Date: Thu, 30 Nov 2006 21:58:08 +0000 (+1100) Subject: added ctdb_connect_wait() X-Git-Tag: tevent-0.9.20~348^2~3010 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=375eeb8a245071c0aacda2c2ef53f31c6587eff3;p=thirdparty%2Fsamba.git added ctdb_connect_wait() (This used to be ctdb commit 0a033f04bbc17db1aaa3a4458149e1e6b055cb9a) --- diff --git a/ctdb/common/ctdb.c b/ctdb/common/ctdb.c index 6ab4b16702f..1ab1f8ab86b 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 = {