diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/adns.lua | 7 | ||||
-rw-r--r-- | net/xmppserver_listener.lua | 2 |
2 files changed, 7 insertions, 2 deletions
diff --git a/net/adns.lua b/net/adns.lua index cb784d40..fb68ea71 100644 --- a/net/adns.lua +++ b/net/adns.lua @@ -3,7 +3,7 @@ local dns = require "net.dns"; local log = require "util.logger".init("adns"); -local coroutine, tostring = coroutine, tostring; +local coroutine, tostring, pcall = coroutine, tostring, pcall; module "adns" @@ -14,7 +14,10 @@ function lookup(handler, qname, qtype, qclass) dns.query(qname, qtype, qclass); coroutine.yield(nil); -- Wait for reply log("debug", "Reply for "..qname.." (%s)", tostring(coroutine.running())); - handler(dns.peek(qname, qtype, qclass)); + local ok, err = pcall(handler, dns.peek(qname, qtype, qclass)); + if not ok then + log("debug", "Error in DNS response handler: %s", tostring(err)); + end end)(); end diff --git a/net/xmppserver_listener.lua b/net/xmppserver_listener.lua index 66fa2f95..0770a355 100644 --- a/net/xmppserver_listener.lua +++ b/net/xmppserver_listener.lua @@ -131,7 +131,9 @@ function xmppserver.disconnect(conn, err) local session = sessions[conn]; if session then if err and err ~= "closed" and session.srv_hosts then + (session.log or log)("debug", "s2s connection closed unexpectedly"); if s2s_attempt_connect(session, err) then + (session.log or log)("debug", "...so we're going to try again"); return; -- Session lives for now end end |