Comparison

core/sessionmanager.lua @ 6404:938cc782c14d

core.sessionmanager: Set a fake thread on destroyed sessions, fixes traceback if stanzas are emitted after a session is destroyed (thanks Sven Blumenstein)
author Kim Alvefur <zash@zash.se>
date Thu, 11 Sep 2014 00:09:07 +0200
parent 5776:bd0ff8ae98a8
child 6551:784fa05cf594
comparison
equal deleted inserted replaced
6403:166d1bd8fc38 6404:938cc782c14d
65 end 65 end
66 end 66 end
67 67
68 function session.send(data) log("debug", "Discarding data sent to resting session: %s", tostring(data)); return false; end 68 function session.send(data) log("debug", "Discarding data sent to resting session: %s", tostring(data)); return false; end
69 function session.data(data) log("debug", "Discarding data received from resting session: %s", tostring(data)); end 69 function session.data(data) log("debug", "Discarding data received from resting session: %s", tostring(data)); end
70 session.thread = { run = function (_, data) return session.data(data) end };
70 return setmetatable(session, resting_session); 71 return setmetatable(session, resting_session);
71 end 72 end
72 73
73 function destroy_session(session, err) 74 function destroy_session(session, err)
74 (session.log or log)("debug", "Destroying session for %s (%s@%s)%s", session.full_jid or "(unknown)", session.username or "(unknown)", session.host or "(unknown)", err and (": "..err) or ""); 75 (session.log or log)("debug", "Destroying session for %s (%s@%s)%s", session.full_jid or "(unknown)", session.username or "(unknown)", session.host or "(unknown)", err and (": "..err) or "");