From 8e17c76cefde6f3932b99a83150e8ea38761e3ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ho=C3=A0ng=20Rio?= Date: Tue, 9 Jul 2024 15:05:57 +0700 Subject: [PATCH] Check current client filtering before init --- internal/filtering/filter.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/filtering/filter.go b/internal/filtering/filter.go index f534ca25cab..4b830eea734 100644 --- a/internal/filtering/filter.go +++ b/internal/filtering/filter.go @@ -295,6 +295,11 @@ func (d *DNSFilter) LoadClientFilters(array []ClientFilterYAML) { func (d *DNSFilter) InitForClient(clientName string, whiteListFilters, filters []FilterYAML, userRules []string) { d.clientEngineLock.Lock() defer d.clientEngineLock.Unlock() + _, ok := d.ClientsFilteringEngine[clientName] + if ok { + log.Info("filtering: client filtering of client: %s already initiated", clientName) + return + } log.Info("filtering: start init client filtering for client: %s", clientName) d.LoadFilters(whiteListFilters) d.LoadFilters(filters) @@ -350,7 +355,7 @@ func (d *DNSFilter) InitForClient(clientName string, whiteListFilters, filters [ // Make sure that the OS reclaims memory as soon as possible. debug.FreeOSMemory() - log.Info("Finish init client filtering for client: %s", clientName) + log.Info("filtering: finish init client filtering for client: %s", clientName) } func deduplicateFilters(filters []FilterYAML) (deduplicated []FilterYAML) {