From d405edb481bb08ee5db482142c65064902899bd3 Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Sat, 29 Dec 2018 15:56:39 +0100 Subject: [PATCH] omcproxy: optimize interface triggers Before installing an interface triggger check if an interface trigger for the interface is already in place. This avoids installing identical interface triggers for a given interface Signed-off-by: Hans Dedecker --- package/network/services/omcproxy/Makefile | 2 +- .../network/services/omcproxy/files/omcproxy.init | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/package/network/services/omcproxy/Makefile b/package/network/services/omcproxy/Makefile index 8f0c8b7d31..a02642284b 100644 --- a/package/network/services/omcproxy/Makefile +++ b/package/network/services/omcproxy/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=omcproxy -PKG_RELEASE:=7 +PKG_RELEASE:=8 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/omcproxy.git diff --git a/package/network/services/omcproxy/files/omcproxy.init b/package/network/services/omcproxy/files/omcproxy.init index 30816e34fd..757b7794ef 100644 --- a/package/network/services/omcproxy/files/omcproxy.init +++ b/package/network/services/omcproxy/files/omcproxy.init @@ -51,7 +51,16 @@ omcproxy_add_network_triggers() { config_get downlinks $1 downlink for link in $uplink $downlinks; do - procd_add_interface_trigger "interface.*" $link /etc/init.d/omcproxy restart + local duplicate=0 + + for l in $LINKS; do + [ "$l" = "$link" ] && duplicate=1 + done + + [ "$duplicate" = 0 ] && { + LINKS="$LINKS $link" + procd_add_interface_trigger "interface.*" $link /etc/init.d/omcproxy restart + } done } @@ -114,6 +123,8 @@ omcproxy_add_firewall_rules() { } service_triggers() { + LINKS="" + procd_add_reload_trigger "omcproxy" config_foreach omcproxy_add_network_triggers proxy } -- 2.25.1