net.dns: Support for resolving AAAA records
[prosody.git] / net / connlisteners.lua
index ee54f0494e9a9b4ef92149f737172f19256daf30..7da25c62df3e4d52c7824d71432c516ff16650e1 100644 (file)
@@ -1,6 +1,6 @@
 -- Prosody IM
--- Copyright (C) 2008-2009 Matthew Wild
--- Copyright (C) 2008-2009 Waqas Hussain
+-- Copyright (C) 2008-2010 Matthew Wild
+-- Copyright (C) 2008-2010 Waqas Hussain
 -- 
 -- This project is MIT/X11 licensed. Please see the
 -- COPYING file in the source package for more information.
@@ -13,8 +13,10 @@ local server = require "net.server";
 local log = require "util.logger".init("connlisteners");
 local tostring = tostring;
 
-local dofile, pcall, error = 
-       dofile, pcall, error
+local dofile, xpcall, error =
+      dofile, xpcall, error
+
+local debug_traceback = debug.traceback;
 
 module "connlisteners"
 
@@ -37,7 +39,7 @@ end
 function get(name)
        local h = listeners[name];
        if not h then
-               local ok, ret = pcall(dofile, listeners_dir..name:gsub("[^%w%-]", "_").."_listener.lua");
+               local ok, ret = xpcall(function() dofile(listeners_dir..name:gsub("[^%w%-]", "_").."_listener.lua") end, debug_traceback);
                if not ok then
                        log("error", "Error while loading listener '%s': %s", tostring(name), tostring(ret));
                        return nil, ret;