Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Ensure we mark sent knocks as outliers
Browse files Browse the repository at this point in the history
  • Loading branch information
richvdh committed Sep 21, 2021
1 parent 4054dfa commit 54b0e52
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog.d/10873.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug introduced in Synapse 1.37.0 which caused `knock` events which we sent to remote servers to be incorrectly stored in the local database.
14 changes: 11 additions & 3 deletions synapse/handlers/federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,9 +820,6 @@ async def do_remotely_reject_invite(
origin, event, room_version = await self._make_and_verify_event(
target_hosts, room_id, user_id, "leave", content=content
)
# Mark as outlier as we don't have any state for this event; we're not
# even in the room.
event.internal_metadata.outlier = True
event.internal_metadata.out_of_band_membership = True

# Try the host that we successfully called /make_leave/ on first for
Expand Down Expand Up @@ -868,6 +865,17 @@ async def _make_and_verify_event(
assert event.user_id == user_id
assert event.state_key == user_id
assert event.room_id == room_id

# if this is a proto-join, it will never get peristed in its current form
# (instead we'll end up persisting the event that comes back from /send_join),
# so it doesn't really matter if we mark it as an outlier or not, but let's
# do so for consistency.
#
# Otherwise (ie, if it's an invite-rejecting leave or a knock), we need
# to mark it as an outlier because we don't yet know the state at this point
# in the DAG.
event.internal_metadata.outlier = True

return origin, event, room_version

async def on_make_leave_request(
Expand Down

0 comments on commit 54b0e52

Please sign in to comment.