# HG changeset patch # User Matthew Wild # Date 1293166333 0 # Node ID 7910f36e279172760c98a527970e7b0a69d47cc1 # Parent 79eff24765969798a3235fdaea75e181c49538b9 net.dns: resolver:query(): Handle getsocket() failures, and return true on success diff -r 79eff2476596 -r 7910f36e2791 net/dns.lua --- a/net/dns.lua Fri Dec 24 04:51:34 2010 +0000 +++ b/net/dns.lua Fri Dec 24 04:52:13 2010 +0000 @@ -722,7 +722,10 @@ --set(self.yielded, co, qclass, qtype, qname, true); end - local conn = self:getsocket(o.server) + local conn, err = self:getsocket(o.server) + if not conn then + return nil, err; + end conn:send (o.packet) if timer and self.timeout then @@ -734,16 +737,18 @@ i = i + 1; self:servfail(conn); o.server = self.best_server; - conn = self:getsocket(o.server); - conn:send(o.packet); - return self.timeout; - else - -- Tried everything, failed - self:cancel(qclass, qtype, qname, co, true); + conn, err = self:getsocket(o.server); + if conn then + conn:send(o.packet); + return self.timeout; + end end + -- Tried everything, failed + self:cancel(qclass, qtype, qname, co, true); end end) end + return true; end function resolver:servfail(sock)