ctdb-daemon: Improve readability of code by nesting if-statements
authorMartin Schwenke <martin@meltin.net>
Fri, 8 May 2015 02:34:43 +0000 (12:34 +1000)
committerAmitay Isaacs <amitay@samba.org>
Wed, 13 May 2015 04:42:13 +0000 (06:42 +0200)
ctdb_sys_have_ip() should only be run if if do_publicipcheck is set.
This is clearer if written as 2 nested if-statements rather than as a
lazy conjuction.

Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_takeover.c

index b09abd3a16bae8fe16db6b2285c19903ccea55f2..7c18542d0bed43fd04a48bcf73939d4511eb6d37 100644 (file)
@@ -873,12 +873,16 @@ static void release_ip_callback(struct ctdb_context *ctdb, int status,
                ctdb_ban_self(ctdb);
        }
 
-       if (ctdb->do_checkpublicip && ctdb_sys_have_ip(state->addr)) {
-               DEBUG(DEBUG_ERR, ("IP %s still hosted during release IP callback, failing\n",
-                                 ctdb_addr_to_str(state->addr)));
-               ctdb_request_control_reply(ctdb, state->c, NULL, -1, NULL);
-               talloc_free(state);
-               return;
+       if (ctdb->do_checkpublicip) {
+               if  (ctdb_sys_have_ip(state->addr)) {
+                       DEBUG(DEBUG_ERR,
+                             ("IP %s still hosted during release IP callback, failing\n",
+                              ctdb_addr_to_str(state->addr)));
+                       ctdb_request_control_reply(ctdb, state->c,
+                                                  NULL, -1, NULL);
+                       talloc_free(state);
+                       return;
+               }
        }
 
        /* send a message to all clients of this node telling them