From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 36BEC2EC6A for ; Wed, 15 May 2019 15:36:50 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mV8AuyYbDPO4 for ; Wed, 15 May 2019 15:36:50 -0400 (EDT) Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id E76242C7A3 for ; Wed, 15 May 2019 15:36:49 -0400 (EDT) From: Vladislav Shpilevoy Subject: [tarantool-patches] [PATCH 02/10] swim: make swim_new_round() void Date: Wed, 15 May 2019 22:36:39 +0300 Message-Id: <745abc0d14765897d4af8ba52a5a78ad229fb568.1557948687.git.v.shpilevoy@tarantool.org> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org Cc: kostja@tarantool.org Firstly, I thought that there is an error - swim_begin_step() does not reschedules round timer, when new_round() fails. But then new_round() appeared never failing. This commit makes it void to eliminate confusion. Probably it is a legacy since the shuffled members array was allocated and freed in new_round(). Part of #3234 --- src/lib/swim/swim.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/lib/swim/swim.c b/src/lib/swim/swim.c index 725ebf222..a9a0a39b3 100644 --- a/src/lib/swim/swim.c +++ b/src/lib/swim/swim.c @@ -844,7 +844,7 @@ swim_shuffle_members(struct swim *swim) * Shuffle members, build randomly ordered queue of addressees. In * other words, do all round preparation work. */ -static int +static void swim_new_round(struct swim *swim) { int size = mh_size(swim->members); @@ -852,7 +852,7 @@ swim_new_round(struct swim *swim) assert(swim->self != NULL); say_verbose("SWIM %d: skip a round - no members", swim_fd(swim)); - return 0; + return; } /* -1 for self. */ say_verbose("SWIM %d: start a new round with %d members", swim_fd(swim), @@ -866,7 +866,6 @@ swim_new_round(struct swim *swim) in_round_queue); } } - return 0; } /** @@ -1078,12 +1077,10 @@ swim_begin_step(struct ev_loop *loop, struct ev_timer *t, int events) (void) events; (void) loop; struct swim *swim = (struct swim *) t->data; - if (! rlist_empty(&swim->round_queue)) { + if (! rlist_empty(&swim->round_queue)) say_verbose("SWIM %d: continue the round", swim_fd(swim)); - } else if (swim_new_round(swim) != 0) { - diag_log(); - return; - } + else + swim_new_round(swim); /* * Possibly empty, if no members but self are specified. */ @@ -1994,11 +1991,7 @@ swim_quit(struct swim *swim) swim_ev_timer_stop(loop(), &swim->wait_ack_tick); swim_scheduler_stop_input(&swim->scheduler); /* Start the last round - quiting. */ - if (swim_new_round(swim) != 0) { - diag_log(); - swim_delete(swim); - return; - } + swim_new_round(swim); struct swim_task *task = &swim->round_step_task; swim_task_destroy(task); swim_task_create(task, swim_quit_step_complete, swim_task_delete_cb, -- 2.20.1 (Apple Git-117)