Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix(prosody): Avoid using stale room instances. (#16492)
Дамян Минков5580301ef778
diff --git a/resources/prosody-plugins/mod_muc_lobby_rooms.lua b/resources/prosody-plugins/mod_muc_lobby_rooms.luaindex 361381718e..5a15fd8988 100644--- a/resources/prosody-plugins/mod_muc_lobby_rooms.lua+++ b/resources/prosody-plugins/mod_muc_lobby_rooms.lua@@ -48,6 +48,7 @@ local NOTIFY_LOBBY_ACCESS_DENIED = 'LOBBY-ACCESS-DENIED';local util = module:require "util";local ends_with = util.ends_with;local get_room_by_name_and_subdomain = util.get_room_by_name_and_subdomain;+local get_room_from_jid = util.get_room_from_jid;local is_healthcheck_room = util.is_healthcheck_room;local presence_check_status = util.presence_check_status;local process_host_module = util.process_host_module;@@ -105,7 +106,7 @@ end-- Sends a json message notifying that the jid was granted/denied access in lobby-- the message from is the actor that did the operation-function notify_lobby_access(room, actor, jid, display_name, granted)+function notify_lobby_access(room_jid, actor, jid, display_name, granted)local notify_json = {value = jid,name = display_name@@ -116,6 +117,12 @@ function notify_lobby_access(room, actor, jid, display_name, granted)notify_json.event = NOTIFY_LOBBY_ACCESS_DENIED;end+ local room = get_room_from_jid(room_jid);+ if not room then+ module:log('error', 'Room not found for %s', room_jid)+ return;+ end+broadcast_json_msg(room, actor, notify_json);end@@ -227,7 +234,7 @@ function attach_lobby_room(room, actor)-- avoid lobby destroy while it is enablednew_room:set_persistent(true);module:log("info","Lobby room jid = %s created from:%s", lobby_room_jid, actor);- new_room.main_room = room;+ new_room.main_room_jid = room.jid;room._data.lobbyroom = new_room.jid;room:save(true);return true@@ -245,6 +252,8 @@ function destroy_lobby_room(room, newjid, message)if lobby_room_obj thenlobby_room_obj:set_persistent(false);lobby_room_obj:destroy(newjid, message);++ module:log('info', 'Lobby room destroyed %s', lobby_room_obj.jid)endroom._data.lobbyroom = nil;room._data.lobby_extra_reason = nil;@@ -412,13 +421,18 @@ function process_lobby_muc_loaded(lobby_muc, host_module)local room_mt = lobby_muc_service.room_mt;-- we base affiliations (roles) in lobby muc component to be based on the roles in the main mucroom_mt.get_affiliation = function(room, jid)- if not room.main_room then+ if not room.main_room_jid thenmodule:log('error', 'No main room(%s) for %s!', room.jid, jid);return 'none';end-- moderators in main room are moderators here- local role = room.main_room.get_affiliation(room.main_room, jid);+ local main_room = get_room_from_jid(room.main_room_jid);+ if not main_room then+ module:log('error', 'Main room not found for %s!', room.main_room_jid);+ return 'none';+ end+ local role = main_room.get_affiliation(main_room, jid);if role thenreturn role;end@@ -433,7 +447,7 @@ function process_lobby_muc_loaded(lobby_muc, host_module)local display_name = occupant:get_presence():get_child_text('nick', 'http://jabber.org/protocol/nick');-- we need to notify in the main room- notify_lobby_access(room.main_room, actor, occupant.nick, display_name, false);+ notify_lobby_access(room.main_room_jid, actor, occupant.nick, display_name, false);endend);end@@ -589,7 +603,7 @@ process_host_module(main_muc_component_config, function(host_module, host)local display_name = occupant:get_presence():get_child_text('nick', 'http://jabber.org/protocol/nick');- notify_lobby_access(room, from, occupant.nick, display_name, true);+ notify_lobby_access(room.jid, from, occupant.nick, display_name, true);endendenddiff --git a/resources/prosody-plugins/mod_muc_rate_limit.lua b/resources/prosody-plugins/mod_muc_rate_limit.luaindex 612984bee7..97eb35343a 100644--- a/resources/prosody-plugins/mod_muc_rate_limit.lua+++ b/resources/prosody-plugins/mod_muc_rate_limit.lua@@ -108,7 +108,13 @@ module:hook("muc-occupant-pre-join", function (event)if not room.join_rate_queue_timer thentimer.add_task(1, function ()- local status, result = pcall(timer_process_queue_elements,+ if room.destroying then+ -- if room was destroyed in the mean time, ignore+ return;+ end++ local status, result = pcall(+ timer_process_queue_elements,join_rate_per_conference,room.join_rate_presence_queue,function(ev)