mod_websocket: Fire pre-session-close event (fixes #1800)
This event was added in a7c183bb4e64 and is required to make mod_smacks know
that a session was intentionally closed and shouldn't be hibernated (see
fcea4d9e7502).
Because this was missing from mod_websocket's session.close(), mod_smacks
would always attempt to hibernate websocket sessions even if they closed
cleanly.
That mod_websocket has its own copy of session.close() is something to fix
another day (probably not in the stable branch). So for now this commit makes
the minimal change to get things working again.
Thanks to Damian and the Jitsi team for reporting.
-- Compatibility layer for bitwise operations
-- First try the bit32 lib
-- Lua 5.3 has it with compat enabled
-- Lua 5.2 has it by default
if _G.bit32 then
return _G.bit32;
else
-- Lua 5.1 may have it as a standalone module that can be installed
local ok, bitop = pcall(require, "bit32")
if ok then
return bitop;
end
end
do
-- Lua 5.3 and 5.4 would be able to use native infix operators
local ok, bitop = pcall(require, "util.bit53")
if ok then
return bitop;
end
end
do
-- Lastly, try the LuaJIT bitop library
local ok, bitop = pcall(require, "bit")
if ok then
return bitop;
end
end
error "No bit module found. See https://prosody.im/doc/depends#bitop";