From 41d5de6e8d14b9bd31180bb7d11058d16e9faa14 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Fri, 19 Jan 2018 00:06:18 +0100 Subject: [PATCH] Scheduling --- dnscrypt-proxy/config.go | 2 +- dnscrypt-proxy/main.go | 3 ++- dnscrypt-proxy/sources.go | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dnscrypt-proxy/config.go b/dnscrypt-proxy/config.go index f07e613d..2dd677b8 100644 --- a/dnscrypt-proxy/config.go +++ b/dnscrypt-proxy/config.go @@ -160,11 +160,11 @@ func ConfigLoad(proxy *Proxy, svcFlag *string, config_file string) error { source.RefreshDelay = 24 } source, sourceUrlsToPrefetch, err := NewSource(source.URL, source.MinisignKeyStr, source.CacheFile, source.FormatStr, time.Duration(source.RefreshDelay)*time.Hour) + proxy.urlsToPrefetch = append(proxy.urlsToPrefetch, sourceUrlsToPrefetch...) if err != nil { dlog.Criticalf("Unable use source [%s]: [%s]", sourceName, err) continue } - proxy.urlsToPrefetch = append(proxy.urlsToPrefetch, sourceUrlsToPrefetch...) registeredServers, err := source.Parse() if err != nil { dlog.Criticalf("Unable use source [%s]: [%s]", sourceName, err) diff --git a/dnscrypt-proxy/main.go b/dnscrypt-proxy/main.go index 68dff9da..7e22b8a2 100644 --- a/dnscrypt-proxy/main.go +++ b/dnscrypt-proxy/main.go @@ -54,6 +54,8 @@ type App struct { func main() { dlog.Init("dnscrypt-proxy", dlog.SeverityNotice, "DAEMON") + dlog.Noticef("Starting dnscrypt-proxy %s", AppVersion) + cdLocal() svcConfig := &service.Config{ @@ -99,7 +101,6 @@ func main() { } func (app *App) Start(service service.Service) error { - dlog.Noticef("Starting dnscrypt-proxy %s", AppVersion) proxy := app.proxy if err := InitPluginsGlobals(&proxy.pluginsGlobals, &proxy); err != nil { dlog.Fatal(err) diff --git a/dnscrypt-proxy/sources.go b/dnscrypt-proxy/sources.go index 25eae58f..f7766862 100644 --- a/dnscrypt-proxy/sources.go +++ b/dnscrypt-proxy/sources.go @@ -123,11 +123,13 @@ func NewSource(url string, minisignKeyStr string, cacheFile string, formatStr st } in, cached, fromBackup, delayTillNextUpdate, err := fetchWithCache(url, cacheFile, refreshDelay) if err != nil { + dlog.Debugf("Scheduling [%s] for prefetch", url) return source, urlsToPrefetch, err } sigCacheFile := cacheFile + ".minisig" sigStr, sigCached, sigFromBackup, sigDelayTillNextUpdate, err := fetchWithCache(sigURL, sigCacheFile, refreshDelay) if err != nil { + dlog.Debugf("Scheduling [%s] for prefetch", sigURL) return source, urlsToPrefetch, err } signature, err := minisign.DecodeSignature(sigStr)