aboutsummaryrefslogtreecommitdiffstats
path: root/core/xmlhandlers.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-10-04 15:25:54 +0100
committerMatthew Wild <mwild1@gmail.com>2008-10-04 15:25:54 +0100
commit88af2ea6e9728680b5f0216143246d8486952b91 (patch)
tree713c6073186469d4a775336f9a20c604a2c88879 /core/xmlhandlers.lua
parent762a906e3654c3179c025a2886e9b7f4821f8666 (diff)
downloadprosody-88af2ea6e9728680b5f0216143246d8486952b91.tar.gz
prosody-88af2ea6e9728680b5f0216143246d8486952b91.zip
Session destruction fixes, some debugging code while we fix the rest. Also change logger to be more useful.
Diffstat (limited to 'core/xmlhandlers.lua')
-rw-r--r--core/xmlhandlers.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/core/xmlhandlers.lua b/core/xmlhandlers.lua
index 1ce7527d..ebc8f91d 100644
--- a/core/xmlhandlers.lua
+++ b/core/xmlhandlers.lua
@@ -10,6 +10,7 @@ local t_insert = table.insert;
local t_remove = table.remove;
local t_concat = table.concat;
local t_concatall = function (t, sep) local tt = {}; for _, s in ipairs(t) do t_insert(tt, tostring(s)); end return t_concat(tt, sep); end
+local sm_destroy_session = import("core.sessionmanager", "destroy_session");
local error = error;
@@ -60,7 +61,15 @@ function init_xmlhandlers(session)
end
function xml_handlers:EndElement(name)
curr_ns,name = name:match("^(.+):(%w+)$");
- if (not stanza) or #stanza.last_add < 0 or (#stanza.last_add > 0 and name ~= stanza.last_add[#stanza.last_add].name) then error("XML parse error in client stream"); end
+ if (not stanza) or #stanza.last_add < 0 or (#stanza.last_add > 0 and name ~= stanza.last_add[#stanza.last_add].name) then
+ if name == "stream" then
+ log("debug", "Stream closed");
+ sm_destroy_session(session);
+ return;
+ else
+ error("XML parse error in client stream");
+ end
+ end
if stanza and #chardata > 0 then
-- We have some character data in the buffer
stanza:text(t_concat(chardata));