Software /
code /
prosody
Comparison
core/xmlhandlers.lua @ 2037:a919511c45ac
xmlhandlers: Reset state on error or stream close, fixes possible traceback
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 21 Oct 2009 14:05:33 +0100 |
parent | 1523:841d61be198f |
child | 2077:e33658f6052c |
comparison
equal
deleted
inserted
replaced
2036:0f9c121713e1 | 2037:a919511c45ac |
---|---|
112 if (not stanza) or (#stanza.last_add > 0 and name ~= stanza.last_add[#stanza.last_add].name) then | 112 if (not stanza) or (#stanza.last_add > 0 and name ~= stanza.last_add[#stanza.last_add].name) then |
113 if tagname == stream_tag then | 113 if tagname == stream_tag then |
114 if cb_streamclosed then | 114 if cb_streamclosed then |
115 cb_streamclosed(session); | 115 cb_streamclosed(session); |
116 end | 116 end |
117 return; | |
118 elseif name == "error" then | 117 elseif name == "error" then |
119 cb_error(session, "stream-error", stanza); | 118 cb_error(session, "stream-error", stanza); |
120 else | 119 else |
121 cb_error(session, "parse-error", "unexpected-element-close", name); | 120 cb_error(session, "parse-error", "unexpected-element-close", name); |
122 end | 121 end |
122 stanza, chardata = nil, {}; | |
123 return; | |
123 end | 124 end |
124 if #chardata > 0 then | 125 if #chardata > 0 then |
125 -- We have some character data in the buffer | 126 -- We have some character data in the buffer |
126 stanza:text(t_concat(chardata)); | 127 stanza:text(t_concat(chardata)); |
127 chardata = {}; | 128 chardata = {}; |