# HG changeset patch # User Kim Alvefur # Date 1431346655 -7200 # Node ID 8f12afb633ece34922dbaf519e1f3c4765eca190 # Parent 160c35d2a5a2ad8231a055cf7389e07895221101 mod_storage_xmlarchive: Attempt to recover after parse failures diff -r 160c35d2a5a2 -r 8f12afb633ec mod_storage_xmlarchive/mod_storage_xmlarchive.lua --- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Mon May 11 14:16:23 2015 +0200 +++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Mon May 11 14:17:35 2015 +0200 @@ -69,7 +69,13 @@ local stream = new_stream(stream_sess, { handlestanza = cb, stream_ns = "jabber:client"}); local dates = dm.list_load(username, module.host, self.store) or empty; stream:feed(st.stanza("stream", { xmlns = "jabber:client" }):top_tag()); - stream_sess.notopen = nil; + local function reset_stream() + stream:reset(); + stream_sess.notopen = true; + stream:feed(st.stanza("stream", { xmlns = "jabber:client" }):top_tag()); + stream_sess.notopen = nil; + end + reset_stream(); local limit = query.limit; local start_day, step, last_day = 1, 1, #dates; @@ -140,6 +146,7 @@ local ok, err = stream:feed(data); if not ok then module:log("warn", "Parse error in %s at %d+%d: %s", filename, item.offset, item.length, err); + reset_stream(); end if result then local stanza = result;