plugin XEP-0384: Fix reentrancy loop:

When `prepare_for_profile` is called during connection init, an infinite loop could happen
with 'get_session_manager` calling `prepare_for_profile`. A check is added to early exit
if the profile is already being prepared, avoiding this issue.
This commit is contained in:
Goffi 2026-05-03 11:32:11 +02:00
commit ee4c80e4d1

View file

@ -2702,6 +2702,13 @@ class OMEMO:
@param items_event: The event.
@param profile: The profile this event belongs to.
"""
# Skip if session manager is already being built to prevent reentrancy loop
# (device list refresh during init triggers this handler again)
if profile in self.__session_manager_waiters:
log.debug(
f"Ignoring device list update for {profile} (session manager being built)"
)
return
sender = cast(jid.JID, items_event.sender)
items = cast(List[domish.Element], items_event.items)