From f0e76c9dd2a6d8764d1ba927c8f94cc580f0f7fd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Wed, 14 Aug 2019 17:16:58 +0200 Subject: [PATCH] modules/ta_signal_query: optimize Basically the same as the parent commit (just much simpler). --- modules/ta_signal_query/ta_signal_query.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/ta_signal_query/ta_signal_query.lua b/modules/ta_signal_query/ta_signal_query.lua index d1945c7e7..081d7982d 100644 --- a/modules/ta_signal_query/ta_signal_query.lua +++ b/modules/ta_signal_query/ta_signal_query.lua @@ -50,10 +50,13 @@ local function send_ta_query(domain) end -- act on DNSKEY queries which were not answered from cache -function M.layer.consume(state, req, _) - local qry = req:current() - if qry.stype == kres.type.DNSKEY and not qry.flags.CACHED then - send_ta_query(qry:name()) +function M.layer.consume(state, req, pkt) + -- First check for standard "cached packets": PKT_SIZE_NOWIRE, for efficiency. + if pkt.size ~= -1 and pkt:qtype() == kres.type.DNSKEY then + local qry = req:current() + if not qry.flags.CACHED then + send_ta_query(qry:name()) + end end return state -- do not interfere with normal query processing end -- 2.47.2