This simplifies the code a bit and makes the code flow clearer as it only adds three curly brackets in check_coarse_timers. Merging the resulting check_coarse_timers_dowork function into the caller and called function as with the other function does not make sense here since it does more than similar function.
Signed-off-by: Arne Schwabe <a...@rfc2549.org> --- src/openvpn/forward.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index 36e5c175..7ed8d0d7 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -700,8 +700,14 @@ process_coarse_timers(struct context *c) } static void -check_coarse_timers_dowork(struct context *c) +check_coarse_timers(struct context *c) { + if (now < c->c2.coarse_timer_wakeup) + { + context_reschedule_sec(c, c->c2.coarse_timer_wakeup - now); + return; + } + const struct timeval save = c->c2.timeval; c->c2.timeval.tv_sec = BIG_TIMEOUT; c->c2.timeval.tv_usec = 0; @@ -717,20 +723,6 @@ check_coarse_timers_dowork(struct context *c) } } -static inline void -check_coarse_timers(struct context *c) -{ - const time_t local_now = now; - if (local_now >= c->c2.coarse_timer_wakeup) - { - check_coarse_timers_dowork(c); - } - else - { - context_reschedule_sec(c, c->c2.coarse_timer_wakeup - local_now); - } -} - static void check_timeout_random_component_dowork(struct context *c) { -- 2.26.2 _______________________________________________ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel