592 end |
592 end |
593 |
593 |
594 |
594 |
595 function resolver:remember(rr, type) -- - - - - - - - - - - - - - remember |
595 function resolver:remember(rr, type) -- - - - - - - - - - - - - - remember |
596 --print ('remember', type, rr.class, rr.type, rr.name) |
596 --print ('remember', type, rr.class, rr.type, rr.name) |
|
597 local qname, qtype, qclass = standardize(rr.name, rr.type, rr.class); |
597 |
598 |
598 if type ~= '*' then |
599 if type ~= '*' then |
599 type = rr.type; |
600 type = qtype; |
600 local all = get(self.cache, rr.class, '*', rr.name); |
601 local all = get(self.cache, qclass, '*', qname); |
601 --print('remember all', all); |
602 --print('remember all', all); |
602 if all then append(all, rr); end |
603 if all then append(all, rr); end |
603 end |
604 end |
604 |
605 |
605 self.cache = self.cache or setmetatable({}, cache_metatable); |
606 self.cache = self.cache or setmetatable({}, cache_metatable); |
606 local rrs = get(self.cache, rr.class, type, rr.name) or |
607 local rrs = get(self.cache, qclass, type, qname) or |
607 set(self.cache, rr.class, type, rr.name, setmetatable({}, rrs_metatable)); |
608 set(self.cache, qclass, type, qname, setmetatable({}, rrs_metatable)); |
608 append(rrs, rr); |
609 append(rrs, rr); |
609 |
610 |
610 if type == 'MX' then self.unsorted[rrs] = true; end |
611 if type == 'MX' then self.unsorted[rrs] = true; end |
611 end |
612 end |
612 |
613 |