Return cached entries if device is offline
This commit is contained in:
@@ -317,9 +317,8 @@ func resolveAndCache(ctx context.Context, q *Query, oldCache *RRCache) (rrCache
|
||||
// check if we are online
|
||||
if netenv.GetOnlineStatus() == netenv.StatusOffline {
|
||||
if !netenv.IsConnectivityDomain(q.FQDN) {
|
||||
log.Tracer(ctx).Debugf("resolver: not resolving %s, device is offline", q.FQDN)
|
||||
// we are offline and this is not an online check query
|
||||
return nil, ErrOffline
|
||||
return oldCache, ErrOffline
|
||||
}
|
||||
log.Tracer(ctx).Debugf("resolver: permitting online status test domain %s to resolve even though offline", q.FQDN)
|
||||
}
|
||||
@@ -356,9 +355,8 @@ resolveLoop:
|
||||
return nil, err
|
||||
case netenv.GetOnlineStatus() == netenv.StatusOffline &&
|
||||
!netenv.IsConnectivityDomain(q.FQDN):
|
||||
log.Tracer(ctx).Debugf("resolver: not resolving %s, device is offline", q.FQDN)
|
||||
// we are offline and this is not an online check query
|
||||
return nil, ErrOffline
|
||||
return oldCache, ErrOffline
|
||||
case errors.Is(err, ErrContinue):
|
||||
continue
|
||||
case errors.Is(err, ErrTimeout):
|
||||
|
||||
@@ -324,7 +324,7 @@ func (rrCache *RRCache) GetExtraRRs(ctx context.Context, query *dns.Msg) (extra
|
||||
extra = addExtra(ctx, extra, "async request to refresh the cache has been started")
|
||||
}
|
||||
if rrCache.IsBackup {
|
||||
extra = addExtra(ctx, extra, "this record is served because a fresh request failed")
|
||||
extra = addExtra(ctx, extra, "this record is served because a fresh request was unsuccessful")
|
||||
}
|
||||
|
||||
// Add information about filtered entries.
|
||||
|
||||
Reference in New Issue
Block a user