Software /
code /
prosody
Comparison
plugins/mod_c2s.lua @ 13095:1693bd4de283
core.sessionmanager: Delay closing a replaced connection after replacement
Closing the session invokes ondisconnect and session close logic,
including mod_smacks hibernation and the timer that destroys the session
after a timeout.
By closing the connection after it has been detached from the sessions
table it will no longer invoke the ondetach handler, which should
prevent the above problem.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 07 May 2023 12:27:55 +0200 |
parent | 13093:93c68c454cb8 |
child | 13209:c8d949cf6b09 |
comparison
equal
deleted
inserted
replaced
13094:4002f0aa6a04 | 13095:1693bd4de283 |
---|---|
271 module:hook_global("c2s-session-updated", function (event) | 271 module:hook_global("c2s-session-updated", function (event) |
272 sessions[event.session.conn] = event.session; | 272 sessions[event.session.conn] = event.session; |
273 local replaced_conn = event.replaced_conn; | 273 local replaced_conn = event.replaced_conn; |
274 if replaced_conn then | 274 if replaced_conn then |
275 sessions[replaced_conn] = nil; | 275 sessions[replaced_conn] = nil; |
276 replaced_conn:close(); | |
276 end | 277 end |
277 end); | 278 end); |
278 | 279 |
279 function runner_callbacks:ready() | 280 function runner_callbacks:ready() |
280 if self.data.conn then | 281 if self.data.conn then |