From 02a397d387f2521304001c25439ce38a1673df62 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Wed, 15 Aug 2018 10:26:51 +0100 Subject: [PATCH] Remove registration of functions called on init Only one function used this and it was slow since it got initialised every time the functions were loaded. Signed-off-by: Michael Tremer --- src/functions/functions.dns | 3 --- src/functions/functions.in | 16 ---------------- src/network | 9 +++++---- 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/src/functions/functions.dns b/src/functions/functions.dns index f9483ee..4cd5cb4 100644 --- a/src/functions/functions.dns +++ b/src/functions/functions.dns @@ -238,9 +238,6 @@ dns_server_update() { radvd_update } -# Update resolv.conf(5) when initializing the network. -init_register dns_generate_resolvconf - dns_generate_resolvconf() { local file=${RESOLV_CONF} diff --git a/src/functions/functions.in b/src/functions/functions.in index 15e3531..927d18d 100644 --- a/src/functions/functions.in +++ b/src/functions/functions.in @@ -23,22 +23,6 @@ # PATH variable. export PATH="@utildir@:/usr/local/sbin:/usr/sbin:/sbin:/usr/bin:/bin:${PATH}" -INIT_FUNCTIONS="" - -init_register() { - INIT_FUNCTIONS="${INIT_FUNCTIONS} $@" -} - -init_run() { - local init - for init in ${INIT_FUNCTIONS}; do - ${init} - done - - # Also execute all triggers - triggers_execute_all "init" -} - VERSION="@PACKAGE_VERSION@" NETWORK_VERSION="${VERSION}" diff --git a/src/network b/src/network index f26c0dc..cc6a07e 100644 --- a/src/network +++ b/src/network @@ -1181,9 +1181,6 @@ cli_reset() { # Flush all DNS servers. dns_server_flush - # Re-run the initialization functions - init_run - exit ${EXIT_OK} } @@ -1367,7 +1364,11 @@ cli_raw() { # Process the given action case "${action}" in init) - init_run + # Update resolv.conf(5) when initializing the network + dns_generate_resolvconf + + # Also execute all triggers + triggers_execute_all "init" ;; settings|hostname|port|device|zone|start|stop|restart|status|reset|route|vpn|wireless) -- 2.47.3