Comparison

net/dns.lua @ 5266:5c3a3ef6b769

net.dns: Clean up query list when a server is marked down
author Matthew Wild <mwild1@gmail.com>
date Sat, 22 Dec 2012 12:06:36 +0000
parent 4422:c25dee24623f
child 5267:a2080e5c4eda
comparison
equal deleted inserted replaced
5265:cc2aed452a62 5266:5c3a3ef6b769
547 end 547 end
548 response.question.raw = string.sub(self.packet, offset, self.offset - 1); 548 response.question.raw = string.sub(self.packet, offset, self.offset - 1);
549 549
550 if not force then 550 if not force then
551 if not self.active[response.header.id] or not self.active[response.header.id][response.question.raw] then 551 if not self.active[response.header.id] or not self.active[response.header.id][response.question.raw] then
552 self.active[response.header.id] = nil;
552 return nil; 553 return nil;
553 end 554 end
554 end 555 end
555 556
556 response.answer = self:rrs(response.header.ancount); 557 response.answer = self:rrs(response.header.ancount);
794 local _a = self:getsocket(o.server); 795 local _a = self:getsocket(o.server);
795 if _a then _a:send(o.packet); end 796 if _a then _a:send(o.packet); end
796 end 797 end
797 end 798 end
798 end 799 end
800 if next(queries) == nil then
801 self.active[id] = nil;
802 end
799 end 803 end
800 804
801 if num == self.best_server then 805 if num == self.best_server then
802 self.best_server = self.best_server + 1; 806 self.best_server = self.best_server + 1;
803 if self.best_server > #self.server then 807 if self.best_server > #self.server then
850 if coroutine.status(co) == "suspended" then coroutine.resume(co); end 854 if coroutine.status(co) == "suspended" then coroutine.resume(co); end
851 end 855 end
852 set(self.wanted, q.class, q.type, q.name, nil); 856 set(self.wanted, q.class, q.type, q.name, nil);
853 end 857 end
854 end 858 end
859
855 end 860 end
856 end 861 end
857 end 862 end
858 863
859 return response; 864 return response;