Move the exit for a failing join to the CJ_RES_FAIL case in the switch statement instead of having a separate if check.
Signed-off-by: Christoph Hellwig <[email protected]> --- sheep/group.c | 45 +++++++++++++++------------------------------ 1 file changed, 15 insertions(+), 30 deletions(-) Index: sheepdog/sheep/group.c =================================================================== --- sheepdog.orig/sheep/group.c 2012-08-07 15:57:49.708670155 +0200 +++ sheepdog/sheep/group.c 2012-08-07 15:59:29.832005019 +0200 @@ -1049,14 +1049,6 @@ void sd_join_handler(struct sd_node *joi struct join_message *jm = opaque; uint32_t le = get_latest_epoch(); - if (node_eq(joined, &sys->this_node)) { - if (result == CJ_RES_FAIL) { - eprintf("Failed to join, exiting.\n"); - sys->cdrv->leave(); - exit(1); - } - } - switch (result) { case CJ_RES_JOIN_LATER: add_delayed_node(le, joined); @@ -1076,6 +1068,12 @@ void sd_join_handler(struct sd_node *joi vprintf(SDOG_DEBUG, "join Sheepdog cluster\n"); break; case CJ_RES_FAIL: + if (node_eq(joined, &sys->this_node)) { + eprintf("Failed to join, exiting.\n"); + sys->cdrv->leave(); + exit(1); + } + if (sys->status != SD_STATUS_WAIT_FOR_JOIN) break; -- sheepdog mailing list [email protected] http://lists.wpkg.org/mailman/listinfo/sheepdog
