mirror of
https://github.com/bjc/prosody.git
synced 2025-04-01 20:27:39 +03:00
mod_smacks: Run session destruction code in session's async context
This is the Right Thing and should fix various potential issues and race conditions.
This commit is contained in:
parent
6bbfcd801a
commit
9de5f1149b
1 changed files with 11 additions and 7 deletions
|
@ -541,13 +541,17 @@ module:hook("pre-resource-unbind", function (event)
|
|||
return
|
||||
end
|
||||
|
||||
prosody.main_thread:run(function ()
|
||||
session.log("debug", "Destroying session for hibernating too long");
|
||||
save_old_session(session);
|
||||
session.resumption_token = nil;
|
||||
sessionmanager.destroy_session(session, "Hibernating too long");
|
||||
sessions_expired(1);
|
||||
end);
|
||||
session.thread:run({
|
||||
event = "callback";
|
||||
name = "mod_smacks/destroy_hibernating";
|
||||
callback = function ()
|
||||
session.log("debug", "Destroying session for hibernating too long");
|
||||
save_old_session(session);
|
||||
session.resumption_token = nil;
|
||||
sessionmanager.destroy_session(session, "Hibernating too long");
|
||||
sessions_expired(1);
|
||||
end;
|
||||
});
|
||||
end);
|
||||
if session.conn then
|
||||
local conn = session.conn;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue