]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
fixed incr initialisation
authorAndrew Tridgell <tridge@samba.org>
Fri, 16 Feb 2007 03:48:27 +0000 (14:48 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 16 Feb 2007 03:48:27 +0000 (14:48 +1100)
(This used to be ctdb commit 36f386dcbca98c0bed96713e736170f6d537b83c)

ctdb/ctdb_bench.c

index bbfea00d97ecc1b744ef2ebf5e79ed945b348ee5..e1fcd1916d91e5c1bdf80584a7f2afd8e95208a9 100644 (file)
@@ -149,19 +149,22 @@ static void ring_message_handler(struct ctdb_context *ctdb, uint32_t srvid,
 */
 static void bench_ring(struct ctdb_context *ctdb, struct event_context *ev)
 {
-       TDB_DATA data;
-       int incr, vnn=ctdb_get_vnn(ctdb);
-
-       data.dptr = (uint8_t *)&incr;
-       data.dsize = sizeof(incr);
+       int vnn=ctdb_get_vnn(ctdb);
 
        if (vnn == 0) {
                /* two messages are injected into the ring, moving
                   in opposite directions */
-               int dest = (ctdb_get_vnn(ctdb) + incr) % ctdb_get_num_nodes(ctdb);
+               int dest, incr;
+               TDB_DATA data;
+               
+               data.dptr = (uint8_t *)&incr;
+               data.dsize = sizeof(incr);
+
                incr = 1;
+               dest = (ctdb_get_vnn(ctdb) + incr) % ctdb_get_num_nodes(ctdb);
                ctdb_send_message(ctdb, dest, 0, data);
                incr = -1;
+               dest = (ctdb_get_vnn(ctdb) + incr) % ctdb_get_num_nodes(ctdb);
                ctdb_send_message(ctdb, dest, 0, data);
        }