Browse code

Split pf_check_reload check and check timer in process_coarse_timers

This moves the timer check into process_coarse_timers and makes it
in line with the other functions. The the pf.enabled check is also moved
into process_coarse_timers to make it more clear this only is used if
pf is enabled at all.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20200810143707.5834-8-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20664.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Arne Schwabe authored on 2020/08/10 23:36:57
Showing 2 changed files
... ...
@@ -679,7 +679,11 @@ process_coarse_timers(struct context *c)
679 679
 #endif
680 680
 
681 681
 #ifdef PLUGIN_PF
682
-    pf_check_reload(c);
682
+    if (c->c2.pf.enabled
683
+        && event_timeout_trigger(&c->c2.pf.reload, &c->c2.timeval, ETT_DEFAULT))
684
+    {
685
+        pf_check_reload(c);
686
+    }
683 687
 #endif
684 688
 
685 689
     /* process --route options */
... ...
@@ -547,9 +547,7 @@ pf_check_reload(struct context *c)
547 547
     const int wakeup_transition = 60;
548 548
     bool reloaded = false;
549 549
 
550
-    if (c->c2.pf.enabled
551
-        && c->c2.pf.filename
552
-        && event_timeout_trigger(&c->c2.pf.reload, &c->c2.timeval, ETT_DEFAULT))
550
+    if (c->c2.pf.filename)
553 551
     {
554 552
         platform_stat_t s;
555 553
         if (!platform_stat(c->c2.pf.filename, &s))