From 709b434f55eebd2a4a44a1c7eeb345521146a24c Mon Sep 17 00:00:00 2001 From: Simon Howe Date: Fri, 3 Jul 2020 16:33:34 +0200 Subject: [PATCH] Clean up the Monitor go routine --- prog/weaver/main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/prog/weaver/main.go b/prog/weaver/main.go index acf59413..81acb67d 100644 --- a/prog/weaver/main.go +++ b/prog/weaver/main.go @@ -17,7 +17,6 @@ import ( "github.com/weaveworks/common/mflagext" "github.com/weaveworks/common/signals" "github.com/weaveworks/mesh" - "k8s.io/apimachinery/pkg/util/wait" "github.com/weaveworks/weave/common" "github.com/weaveworks/weave/common/docker" @@ -529,7 +528,9 @@ func main() { weavenet.Reexpose(&bridgeConfig, Log) } - go weavenet.Monitor(Log, "WEAVE-CANARY", []string{"mangle", "nat", "filter"}, applyIPTables, iptablesRefresh, wait.NeverStop) + stopChan := make(chan struct{}) + go weavenet.Monitor(Log, "WEAVE-CANARY", []string{"mangle", "nat", "filter"}, applyIPTables, iptablesRefresh, stopChan) + defer close(stopChan) } else { Log.Printf("Not refreshing iptables (interval: %v)", iptablesRefresh) }