Skip to content

Commit

Permalink
omcproxy: optimize interface triggers
Browse files Browse the repository at this point in the history
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 <dedeckeh@gmail.com>
  • Loading branch information
dedeckeh committed Dec 29, 2018
1 parent df8f8ba commit d405edb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package/network/services/omcproxy/Makefile
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion package/network/services/omcproxy/files/omcproxy.init
Expand Up @@ -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
}

Expand Down Expand Up @@ -114,6 +123,8 @@ omcproxy_add_firewall_rules() {
}

service_triggers() {
LINKS=""

procd_add_reload_trigger "omcproxy"
config_foreach omcproxy_add_network_triggers proxy
}
Expand Down

0 comments on commit d405edb

Please sign in to comment.