summaryrefslogtreecommitdiffstats
path: root/ctdb/tools
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2013-08-16 16:25:28 +1000
committerAmitay Isaacs <amitay@gmail.com>2013-09-19 12:54:30 +1000
commit8a6979dac3a9a0c8035643a1c725cfd9cf33401e (patch)
tree13a3e18c64688067c915cba03dda58f3d569033f /ctdb/tools
parent0ba7e2ce3110a874fd746ecd01d54bd8004e291c (diff)
downloadsamba-8a6979dac3a9a0c8035643a1c725cfd9cf33401e.tar.gz
samba-8a6979dac3a9a0c8035643a1c725cfd9cf33401e.tar.xz
samba-8a6979dac3a9a0c8035643a1c725cfd9cf33401e.zip
tools/ctdb: Change ipreallocate() to use a local done flag
Instead of the current global variable. This is in anticipation of abstracting the code. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit c58ee0eddf7ae3283e3ca8bd25575e6e677e1b17)
Diffstat (limited to 'ctdb/tools')
-rw-r--r--ctdb/tools/ctdb.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index db4b1d31f23..9908899b246 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -1978,15 +1978,15 @@ control_get_all_public_ips(struct ctdb_context *ctdb, TALLOC_CTX *tmp_ctx, struc
}
-static bool ipreallocate_finished;
-
/*
handler for receiving the response to ipreallocate
*/
static void ip_reallocate_handler(struct ctdb_context *ctdb, uint64_t srvid,
TDB_DATA data, void *private_data)
{
- ipreallocate_finished = true;
+ bool *done = (bool *)private_data;
+
+ *done = true;
}
static void ctdb_every_second(struct event_context *ev, struct timed_event *te, struct timeval t, void *p)
@@ -2006,6 +2006,7 @@ static int ipreallocate(struct ctdb_context *ctdb)
int ret;
TDB_DATA data;
struct srvid_request rd;
+ bool done;
struct timeval tv;
/* Time ticks to enable timeouts to be processed */
@@ -2018,12 +2019,15 @@ static int ipreallocate(struct ctdb_context *ctdb)
rd.data = 0;
/* Register message port for reply from recovery master */
- ctdb_client_set_message_handler(ctdb, rd.srvid, ip_reallocate_handler, NULL);
+ ctdb_client_set_message_handler(ctdb, rd.srvid, ip_reallocate_handler,
+ &done);
data.dptr = (uint8_t *)&rd;
data.dsize = sizeof(rd);
again:
+ done = false;
+
/* Send to all connected nodes. Only recmaster replies */
ret = ctdb_client_send_message(ctdb, CTDB_BROADCAST_CONNECTED,
CTDB_SRVID_TAKEOVER_RUN, data);
@@ -2039,11 +2043,11 @@ again:
tv = timeval_current();
/* This loop terminates the reply is received */
- while (timeval_elapsed(&tv) < 5.0 && !ipreallocate_finished) {
+ while (timeval_elapsed(&tv) < 5.0 && !done) {
event_loop_once(ctdb->ev);
}
- if (!ipreallocate_finished) {
+ if (!done == 0) {
DEBUG(DEBUG_NOTICE,
("Still waiting for confirmation of IP reallocation\n"));
goto again;