From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org
Cc: kostja@tarantool.org
Subject: [tarantool-patches] [PATCH 01/10] swim: fix an assertion on attempt to chage timeouts
Date: Wed, 15 May 2019 22:36:37 +0300 [thread overview]
Message-ID: <4c67b85cde841083e2e36a8dafb8ed9a1e162986.1557948687.git.v.shpilevoy@tarantool.org> (raw)
In-Reply-To: <cover.1557948686.git.v.shpilevoy@tarantool.org>
Appeared, that libev does not allow to change ev_timer values in
flight. A timer, reset via ev_timer_set(), should be restarted,
because the function changes 'ev_timer.at', which in turn is used
internally by timer routines.
Part of #3234
---
src/lib/swim/swim.c | 17 ++++++++++++-----
src/lib/swim/swim_ev.h | 2 ++
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/lib/swim/swim.c b/src/lib/swim/swim.c
index 54c5b3250..725ebf222 100644
--- a/src/lib/swim/swim.c
+++ b/src/lib/swim/swim.c
@@ -1797,11 +1797,18 @@ swim_cfg(struct swim *swim, const char *uri, double heartbeat_rate,
} else {
addr = swim->self->addr;
}
- if (swim->round_tick.repeat != heartbeat_rate && heartbeat_rate > 0)
- swim_ev_timer_set(&swim->round_tick, 0, heartbeat_rate);
-
- if (swim->wait_ack_tick.repeat != ack_timeout && ack_timeout > 0)
- swim_ev_timer_set(&swim->wait_ack_tick, 0, ack_timeout);
+ struct ev_timer *t = &swim->round_tick;
+ if (t->repeat != heartbeat_rate && heartbeat_rate > 0) {
+ swim_ev_timer_set(t, 0, heartbeat_rate);
+ if (swim_ev_is_active(t))
+ swim_ev_timer_again(loop(), t);
+ }
+ t = &swim->wait_ack_tick;
+ if (t->repeat != ack_timeout && ack_timeout > 0) {
+ swim_ev_timer_set(t, 0, ack_timeout);
+ if (swim_ev_is_active(t))
+ swim_ev_timer_again(loop(), t);
+ }
if (new_self != NULL) {
swim->self->status = MEMBER_LEFT;
diff --git a/src/lib/swim/swim_ev.h b/src/lib/swim/swim_ev.h
index b68ed9e19..fe261ff38 100644
--- a/src/lib/swim/swim_ev.h
+++ b/src/lib/swim/swim_ev.h
@@ -52,6 +52,8 @@ swim_ev_timer_again(struct ev_loop *loop, struct ev_timer *watcher);
void
swim_ev_timer_stop(struct ev_loop *loop, struct ev_timer *watcher);
+#define swim_ev_is_active ev_is_active
+
#define swim_ev_init ev_init
#define swim_ev_timer_init ev_timer_init
--
2.20.1 (Apple Git-117)
next prev parent reply other threads:[~2019-05-15 19:36 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-15 19:36 [tarantool-patches] [PATCH 00/10] swim Lua API Vladislav Shpilevoy
2019-05-15 19:36 ` Vladislav Shpilevoy [this message]
2019-05-16 7:28 ` [tarantool-patches] Re: [PATCH 01/10] swim: fix an assertion on attempt to chage timeouts Konstantin Osipov
2019-05-15 19:36 ` [tarantool-patches] [PATCH 10/10] swim: cache members in Lua member table Vladislav Shpilevoy
2019-05-16 7:31 ` [tarantool-patches] " Konstantin Osipov
2019-05-15 19:36 ` [tarantool-patches] [PATCH 02/10] swim: make swim_new_round() void Vladislav Shpilevoy
2019-05-16 7:31 ` [tarantool-patches] " Konstantin Osipov
2019-05-15 19:36 ` [tarantool-patches] [PATCH 03/10] swim: validate URI in swim_probe_member() Vladislav Shpilevoy
2019-05-16 7:31 ` [tarantool-patches] " Konstantin Osipov
2019-05-15 19:36 ` [tarantool-patches] [PATCH 04/10] swim: introduce Lua interface Vladislav Shpilevoy
2019-05-15 19:36 ` [tarantool-patches] [PATCH 05/10] swim: Lua bindings to manipulate member table Vladislav Shpilevoy
2019-05-16 7:32 ` [tarantool-patches] " Konstantin Osipov
2019-05-15 19:36 ` [tarantool-patches] [PATCH 06/10] swim: Lua bindings to access individual members Vladislav Shpilevoy
2019-05-15 19:36 ` [tarantool-patches] [PATCH 07/10] swim: pairs() function to iterate over member table Vladislav Shpilevoy
2019-05-15 19:36 ` [tarantool-patches] [PATCH 08/10] swim: allow to use cdata struct tt_uuid in Lua API Vladislav Shpilevoy
2019-05-15 19:36 ` [tarantool-patches] [PATCH 09/10] swim: cache decoded payload in the Lua module Vladislav Shpilevoy
2019-05-16 7:36 ` [tarantool-patches] " Konstantin Osipov
2019-05-16 11:58 ` Vladislav Shpilevoy
2019-05-16 22:46 ` Vladislav Shpilevoy
2019-05-21 16:57 ` [tarantool-patches] Re: [PATCH 00/10] swim Lua API Vladislav Shpilevoy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4c67b85cde841083e2e36a8dafb8ed9a1e162986.1557948687.git.v.shpilevoy@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=kostja@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='Re: [tarantool-patches] [PATCH 01/10] swim: fix an assertion on attempt to chage timeouts' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox