}
}
- if (!qctx->is_zone && qctx->view->staleanswerclienttimeout == 0 &&
- dns_view_staleanswerenabled(qctx->view))
- {
- /*
- * If stale answers are enabled and
- * stale-answer-client-timeout is zero, then we can promptly
- * answer with a stale RRset if one is available in cache.
- */
- qctx->options.stalefirst = true;
- }
+ /*
+ * If stale answers are enabled and stale-answer-client-timeout is zero,
+ * then we can promptly answer with a stale RRset if one is available in
+ * cache.
+ */
+ qctx->options.stalefirst = (!qctx->is_zone &&
+ qctx->view->staleanswerclienttimeout == 0 &&
+ dns_view_staleanswerenabled(qctx->view));
result = query_lookup(qctx);
rpzqname = qctx->client->query.qname;
}
- if (qctx->options.stalefirst) {
+ qctx->client->query.dboptions &= ~DNS_DBFIND_STALETIMEOUT;
+
+ if (qctx->options.stalefirst && !qctx->is_zone) {
/*
* If the 'stalefirst' flag is set, it means that a stale
* RRset may be returned as part of this lookup. An attempt
qctx_freedata(qctx);
dns_db_attach(qctx->client->view->cachedb,
&qctx->db);
- qctx->client->query.dboptions &=
- ~DNS_DBFIND_STALETIMEOUT;
qctx->options.stalefirst = false;
if (FETCH_RECTYPE_NORMAL(qctx->client) != NULL)
{
* setting the 'stalefirst' option, which is usually set in
* the beginning in ns__query_start().
*/
- if (qctx->view->staleanswerclienttimeout == 0 &&
- dns_view_staleanswerenabled(qctx->view))
- {
- qctx->options.stalefirst = true;
- }
+ qctx->options.stalefirst =
+ (qctx->view->staleanswerclienttimeout == 0 &&
+ dns_view_staleanswerenabled(qctx->view));
result = query_lookup(qctx);