openvpn_sleep() is basically "service the management interface for x
seconds, then return". Therefore, manage.c is a more suitable location
than the random collection of unrelated stuff called misc.c.
(I think we should find a better place for everything currently in misc.c,
and get rid of it all together. This patch is part of that effort.)
Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <
1500566435-29920-1-git-send-email-steffan.karger@fox-it.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg15109.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
if (event_timeout_defined(&c->c2.explicit_exit_notification_interval))
{
msg(D_STREAM_ERRORS, "Connection reset during exit notification period, ignoring [%d]", status);
- openvpn_sleep(1);
+ management_sleep(1);
}
else
#endif
/* if so, close tun, delete routes, then reinitialize tun and add routes */
msg(M_INFO, "NOTE: Pulled options changed on restart, will need to close and reopen TUN/TAP device.");
do_close_tun(c, true);
- openvpn_sleep(1);
+ management_sleep(1);
c->c2.did_open_tun = do_open_tun(c);
update_time();
}
if (sec)
{
msg(D_RESTART, "Restart pause, %d second(s)", sec);
- openvpn_sleep(sec);
+ management_sleep(sec);
}
}
}
}
+void
+management_sleep(const int n)
+{
+ if (management)
+ {
+ management_event_loop_n_seconds(management, n);
+ }
+ else
+ {
+ sleep(n);
+ }
+}
+
#else /* ifdef ENABLE_MANAGEMENT */
-static void
-dummy(void)
+
+void
+management_sleep(const int n)
{
+ sleep(n);
}
+
#endif /* ENABLE_MANAGEMENT */
#endif /* MANAGEMENT_DEF_AUTH */
#endif /* ifdef ENABLE_MANAGEMENT */
+
+/**
+ * A sleep function that services the management layer for n seconds rather
+ * than doing nothing.
+ */
+void management_sleep(const int n);
+
#endif /* ifndef MANAGE_H */
}
}
-void
-openvpn_sleep(const int n)
-{
-#ifdef ENABLE_MANAGEMENT
- if (management)
- {
- management_event_loop_n_seconds(management, n);
- return;
- }
-#endif
- sleep(n);
-}
-
/*
* Remove security-sensitive strings from control message
* so that they will not be output to log file.
/* returns true if environmental variable may be passed to an external program */
bool env_allowed(const char *str);
-/*
- * A sleep function that services the management layer for n
- * seconds rather than doing nothing.
- */
-void openvpn_sleep(const int n);
-
void configure_path(void);
const char *sanitize_control_message(const char *str, struct gc_arena *gc);
goto done;
}
- openvpn_sleep(fail_wait_interval);
+ management_sleep(fail_wait_interval);
}
ASSERT(res);
if (status <= 0)
{
- openvpn_sleep(1);
+ management_sleep(1);
continue;
}
break;
}
}
- openvpn_sleep(1);
+ management_sleep(1);
}
if (!nowait && openvpn_close_socket(sd))
#endif
break;
}
- openvpn_sleep(1);
+ management_sleep(1);
continue;
}