Comparison

plugins/mod_smacks.lua @ 12077:061d516d8ac5

mod_smacks: Fix error on shutdown if loaded on Component
author Kim Alvefur <zash@zash.se>
date Mon, 20 Dec 2021 00:04:32 +0100
parent 12076:ad1fe36eaae7
child 12078:2c13aaae35ac
comparison
equal deleted inserted replaced
12076:ad1fe36eaae7 12077:061d516d8ac5
628 628
629 module:hook("s2s-read-timeout", handle_read_timeout); 629 module:hook("s2s-read-timeout", handle_read_timeout);
630 module:hook("c2s-read-timeout", handle_read_timeout); 630 module:hook("c2s-read-timeout", handle_read_timeout);
631 631
632 module:hook_global("server-stopping", function(event) 632 module:hook_global("server-stopping", function(event)
633 if not local_sessions then
634 -- not a VirtualHost, no user sessions
635 return
636 end
633 local reason = event.reason; 637 local reason = event.reason;
634 -- Close smacks-enaled sessions ourselves instead of letting mod_c2s close 638 -- Close smacks-enaled sessions ourselves instead of letting mod_c2s close
635 -- it, which invalidates the smacks session. This allows preserving the 639 -- it, which invalidates the smacks session. This allows preserving the
636 -- counter value, so it can be communicated to the client when it tries to 640 -- counter value, so it can be communicated to the client when it tries to
637 -- resume the lost session after a restart. 641 -- resume the lost session after a restart.