Software /
code /
prosody
Comparison
net/adns.lua @ 2661:be4b1e796bd2
net.adns: Don't treat locally-initiated disconnects as fatal with libevent backend in use (thanks Flo)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 18 Feb 2010 16:44:26 +0000 |
parent | 2652:cbc58fc170ad |
child | 2714:9c5d8e0c146e |
comparison
equal
deleted
inserted
replaced
2660:9e5b21b7b2f9 | 2661:be4b1e796bd2 |
---|---|
52 if data then | 52 if data then |
53 dns.feed(handler, data); | 53 dns.feed(handler, data); |
54 end | 54 end |
55 end | 55 end |
56 function listener.ondisconnect(conn, err) | 56 function listener.ondisconnect(conn, err) |
57 log("warn", "DNS socket for %s disconnected: %s", peername, err); | 57 if err then |
58 local servers = resolver.server; | 58 log("warn", "DNS socket for %s disconnected: %s", peername, err); |
59 if resolver.socketset[conn] == resolver.best_server and resolver.best_server == #servers then | 59 local servers = resolver.server; |
60 log("error", "Exhausted all %d configured DNS servers, next lookup will try %s again", #servers, servers[1]); | 60 if resolver.socketset[conn] == resolver.best_server and resolver.best_server == #servers then |
61 log("error", "Exhausted all %d configured DNS servers, next lookup will try %s again", #servers, servers[1]); | |
62 end | |
63 | |
64 resolver:servfail(conn); -- Let the magic commence | |
61 end | 65 end |
62 | |
63 resolver:servfail(conn); -- Let the magic commence | |
64 end | 66 end |
65 handler = server.wrapclient(sock, "dns", 53, listener); | 67 handler = server.wrapclient(sock, "dns", 53, listener); |
66 if not handler then | 68 if not handler then |
67 log("warn", "handler is nil"); | 69 log("warn", "handler is nil"); |
68 end | 70 end |