Merge with 0.7
[prosody.git] / net / dns.lua
index 10ac50a49c50d25935285c9277925426528fe80f..ca5f3c621d150bc9367ab65d3bc95e11786ad73e 100644 (file)
@@ -594,17 +594,18 @@ end
 
 function resolver:remember(rr, type)    -- - - - - - - - - - - - - -  remember
        --print ('remember', type, rr.class, rr.type, rr.name)
+       local qname, qtype, qclass = standardize(rr.name, rr.type, rr.class);
 
        if type ~= '*' then
-               type = rr.type;
-               local all = get(self.cache, rr.class, '*', rr.name);
+               type = qtype;
+               local all = get(self.cache, qclass, '*', qname);
                --print('remember all', all);
                if all then append(all, rr); end
        end
 
        self.cache = self.cache or setmetatable({}, cache_metatable);
-       local rrs = get(self.cache, rr.class, type, rr.name) or
-               set(self.cache, rr.class, type, rr.name, setmetatable({}, rrs_metatable));
+       local rrs = get(self.cache, qclass, type, qname) or
+               set(self.cache, qclass, type, qname, setmetatable({}, rrs_metatable));
        append(rrs, rr);
 
        if type == 'MX' then self.unsorted[rrs] = true; end
@@ -723,7 +724,7 @@ function resolver:receive(rset)    -- - - - - - - - - - - - - - - - -  receive
        for i,sock in pairs(rset) do
 
                if self.socketset[sock] then
-                       local packet = sock.receive();
+                       local packet = sock:receive();
                        if packet then
                                response = self:decode(packet);
                                if response and self.active[response.header.id]