mirror of
https://github.com/safing/portmaster
synced 2025-09-01 18:19:12 +00:00
Do not suggest using stale DNS cache when disabled by user
This commit is contained in:
parent
5fe78dbad5
commit
fce1a7ac33
2 changed files with 5 additions and 3 deletions
|
@ -63,6 +63,7 @@ var (
|
|||
cfgOptionNoAssignedNameserversOrder = 1
|
||||
|
||||
CfgOptionUseStaleCacheKey = "dns/useStaleCache"
|
||||
useStaleCacheConfigOption *config.Option
|
||||
useStaleCache config.BoolOption
|
||||
cfgOptionUseStaleCacheOrder = 2
|
||||
|
||||
|
@ -205,7 +206,7 @@ The format is: "protocol://ip:port?parameter=value¶meter=value"
|
|||
}
|
||||
noAssignedNameservers = status.SecurityLevelOption(CfgOptionNoAssignedNameserversKey)
|
||||
|
||||
err = config.Register(&config.Option{
|
||||
useStaleCacheConfigOption = &config.Option{
|
||||
Name: "Always Use DNS Cache",
|
||||
Key: CfgOptionUseStaleCacheKey,
|
||||
Description: "Always use the DNS cache, even if entries have expired. Expired entries are refreshed afterwards in the background. This can improve DNS resolving performance a lot, but may lead to occasional connection errors due to outdated DNS records.",
|
||||
|
@ -217,7 +218,8 @@ The format is: "protocol://ip:port?parameter=value¶meter=value"
|
|||
config.DisplayOrderAnnotation: cfgOptionUseStaleCacheOrder,
|
||||
config.CategoryAnnotation: "Resolving",
|
||||
},
|
||||
})
|
||||
}
|
||||
err = config.Register(useStaleCacheConfigOption)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ var suggestUsingStaleCacheNotification *notifications.Notification
|
|||
|
||||
func suggestUsingStaleCacheTask(ctx context.Context, t *modules.Task) error {
|
||||
switch {
|
||||
case useStaleCache():
|
||||
case useStaleCache() || useStaleCacheConfigOption.IsSetByUser():
|
||||
// If setting is already active, disable task repeating.
|
||||
t.Repeat(0)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue