From e98cf5b7114c6fa5c51821b356d9c7c02c534fae Mon Sep 17 00:00:00 2001 From: Nick Peng Date: Tue, 15 Feb 2022 17:35:39 +0800 Subject: [PATCH] cache: fix cache not update issue when serve-expired enabled. --- src/dns_server.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/dns_server.c b/src/dns_server.c index 651b309..1fe7682 100644 --- a/src/dns_server.c +++ b/src/dns_server.c @@ -1929,14 +1929,12 @@ static int _dns_server_reply_passthrouth(struct dns_request *request, struct dns _dns_result_callback(request); } - if (request->conn == NULL) { - return 0; + if (request->conn) { + /* When passthrough, modify the id to be the id of the client request. */ + dns_server_update_reply_packet_id(request, inpacket, inpacket_len); + ret = _dns_reply_inpacket(request, inpacket, inpacket_len); } - /* When passthrough, modify the id to be the id of the client request. */ - dns_server_update_reply_packet_id(request, inpacket, inpacket_len); - ret = _dns_reply_inpacket(request, inpacket, inpacket_len); - if (packet->head.rcode != DNS_RC_NOERROR && packet->head.rcode != DNS_RC_NXDOMAIN) { return ret; }