Software /
code /
prosody
Comparison
plugins/mod_smacks.lua @ 13572:d9965707f7dc
mod_smacks: Prevent traceback on attempting to resume destroyed session
This shouldn't be possible, but seems to happen anyway after net.server
somehow calling the close handler twice, which also should not happen.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 19 Nov 2024 00:53:01 +0100 |
parent | 13544:0aae6de9d323 |
child | 13573:9277fc78fe39 |
comparison
equal
deleted
inserted
replaced
13571:ca041359c045 | 13572:d9965707f7dc |
---|---|
585 return nil, enable_errors.new("already_bound"); | 585 return nil, enable_errors.new("already_bound"); |
586 end | 586 end |
587 | 587 |
588 local id = stanza.attr.previd; | 588 local id = stanza.attr.previd; |
589 local original_session = session_registry[registry_key(session, id)]; | 589 local original_session = session_registry[registry_key(session, id)]; |
590 if original_session.destroyed then | |
591 original_session.log("error", "Tried to resume a destroyed session. This should not happen! %s", debug.traceback()); | |
592 session_registry[registry_key(session, id)] = nil; | |
593 original_session = nil; | |
594 end | |
590 if not original_session then | 595 if not original_session then |
591 local old_session = old_session_registry:get(session.username, id); | 596 local old_session = old_session_registry:get(session.username, id); |
592 if old_session then | 597 if old_session then |
593 session.log("debug", "Tried to resume old expired session with id %s", id); | 598 session.log("debug", "Tried to resume old expired session with id %s", id); |
594 clear_old_session(session, id); | 599 clear_old_session(session, id); |