Skip to content

Commit

Permalink
Pull request home: fix client dns cache
Browse files Browse the repository at this point in the history
Merge in DNS/adguard-home from custom-ups-cache-conf-fix to master

Squashed commit of the following:

commit 01a728e
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Mon Nov 20 11:48:01 2023 +0200

    home: fix client dns cache
  • Loading branch information
Mizzick committed Nov 20, 2023
1 parent 1c0bf95 commit c8f1112
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/home/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ func (clients *clientsContainer) forConfig() (objs []*clientObject) {
UseGlobalBlockedServices: !cli.UseOwnBlockedServices,
IgnoreQueryLog: cli.IgnoreQueryLog,
IgnoreStatistics: cli.IgnoreStatistics,
UpstreamsCacheEnabled: cli.UpstreamsCacheEnabled,
UpstreamsCacheSize: cli.UpstreamsCacheSize,
}

objs = append(objs, o)
Expand Down
8 changes: 8 additions & 0 deletions internal/home/clientshttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ func (clients *clientsContainer) jsonToClient(cj clientJSON, prev *Client) (c *C
return nil, fmt.Errorf("validating blocked services: %w", err)
}

var upsCacheEnabled bool
var upsCacheSize uint32
if prev != nil {
upsCacheEnabled, upsCacheSize = prev.UpstreamsCacheEnabled, prev.UpstreamsCacheSize
}

c = &Client{
safeSearchConf: safeSearchConf,

Expand All @@ -192,6 +198,8 @@ func (clients *clientsContainer) jsonToClient(cj clientJSON, prev *Client) (c *C
UseOwnBlockedServices: !cj.UseGlobalBlockedServices,
IgnoreQueryLog: ignoreQueryLog,
IgnoreStatistics: ignoreStatistics,
UpstreamsCacheEnabled: upsCacheEnabled,
UpstreamsCacheSize: upsCacheSize,
}

if safeSearchConf.Enabled {
Expand Down

0 comments on commit c8f1112

Please sign in to comment.