Skip to content

Commit

Permalink
ctdb-daemon: Use ctdb_find_iface() instead of duplicating logic
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Schwenke <[email protected]>
Reviewed-by: Amitay Isaacs <[email protected]>
  • Loading branch information
martin-schwenke authored and Amitay Isaacs committed Sep 8, 2016
1 parent 2f46056 commit a66072e
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ctdb/server/ctdb_takeover.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ static const char *ctdb_vnn_iface_string(const struct ctdb_vnn *vnn)
return iface_string(vnn->iface);
}

static struct ctdb_interface *ctdb_find_iface(struct ctdb_context *ctdb,
const char *iface);

static struct ctdb_interface *
ctdb_add_local_iface(struct ctdb_context *ctdb, const char *iface)
{
Expand All @@ -114,10 +117,9 @@ ctdb_add_local_iface(struct ctdb_context *ctdb, const char *iface)
}

/* Verify that we don't have an entry for this ip yet */
for (i=ctdb->ifaces;i;i=i->next) {
if (strcmp(i->name, iface) == 0) {
return i;
}
i = ctdb_find_iface(ctdb, iface);
if (i != NULL) {
return i;
}

/* create a new structure for this interface */
Expand Down

0 comments on commit a66072e

Please sign in to comment.