Skip to content

Commit

Permalink
Check current client filtering before init
Browse files Browse the repository at this point in the history
  • Loading branch information
hoang-rio committed Jul 9, 2024
1 parent 8f1576b commit 8e17c76
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/filtering/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 8e17c76

Please sign in to comment.