Software /
code /
prosody
Changeset
4023:7910f36e2791
net.dns: resolver:query(): Handle getsocket() failures, and return true on success
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 24 Dec 2010 04:52:13 +0000 |
parents | 4022:79eff2476596 |
children | 4024:d2f80697c329 |
files | net/dns.lua |
diffstat | 1 files changed, 12 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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)