Diff

net/dns.lua @ 6309:b6f76a52eb36

net.dns: Ensure all pending requests get notified of a timeout when looking up a record (fix for d122420542fb)
author Matthew Wild <mwild1@gmail.com>
date Fri, 25 Jul 2014 12:08:07 +0100
parent 6288:d122420542fb
child 6310:d232bb1bbe1e
line wrap: on
line diff
--- a/net/dns.lua	Thu Jul 03 17:53:24 2014 +0200
+++ b/net/dns.lua	Fri Jul 25 12:08:07 2014 +0100
@@ -770,7 +770,7 @@
 					end
 				end
 				-- Tried everything, failed
-				self:cancel(qclass, qtype, qname, co, true);
+				self:cancel(qclass, qtype, qname);
 			end
 		end)
 	end
@@ -910,13 +910,13 @@
 	return response;
 end
 
-function resolver:cancel(qclass, qtype, qname, co, call_handler)
+function resolver:cancel(qclass, qtype, qname)
 	local cos = get(self.wanted, qclass, qtype, qname);
 	if cos then
-		if call_handler then
-			coroutine.resume(co);
+		for co in pairs(cos) do
+			if coroutine.status(co) == "suspended" then coroutine.resume(co); end
 		end
-		cos[co] = nil;
+		set(self.wanted, qclass, qtype, qname, nil);
 	end
 end