diff options
Diffstat (limited to 'daemon/worker.c')
-rw-r--r-- | daemon/worker.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/daemon/worker.c b/daemon/worker.c index 433b96fd527a..661f6967d41d 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -660,10 +660,7 @@ answer_from_cache(struct worker* worker, struct query_info* qinfo, if(!reply_check_cname_chain(qinfo, rep)) { /* cname chain invalid, redo iterator steps */ verbose(VERB_ALGO, "Cache reply: cname chain broken"); - bail_out: - rrset_array_unlock_touch(worker->env.rrset_cache, - worker->scratchpad, rep->ref, rep->rrset_count); - return 0; + goto bail_out; } } /* check security status of the cached answer */ @@ -758,6 +755,11 @@ answer_from_cache(struct worker* worker, struct query_info* qinfo, } /* go and return this buffer to the client */ return 1; + +bail_out: + rrset_array_unlock_touch(worker->env.rrset_cache, + worker->scratchpad, rep->ref, rep->rrset_count); + return 0; } /** Reply to client and perform prefetch to keep cache up to date. @@ -770,8 +772,14 @@ reply_and_prefetch(struct worker* worker, struct query_info* qinfo, { /* first send answer to client to keep its latency * as small as a cachereply */ - if(sldns_buffer_limit(repinfo->c->buffer) != 0) + if(sldns_buffer_limit(repinfo->c->buffer) != 0) { + if(repinfo->c->tcp_req_info) { + sldns_buffer_copy( + repinfo->c->tcp_req_info->spool_buffer, + repinfo->c->buffer); + } comm_point_send_reply(repinfo); + } server_stats_prefetch(&worker->stats, worker); /* create the prefetch in the mesh as a normal lookup without |