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

Commit

Permalink
Faster Room Joins: fix /make_knock blocking indefinitely when the r…
Browse files Browse the repository at this point in the history
…oom in question is a partial-stated room. (#13583)

Co-authored-by: Sean Quah <[email protected]>
  • Loading branch information
reivilibre and squahtx authored Aug 24, 2022
1 parent 7af07f9 commit ba882c0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/13583.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Faster Room Joins: fix `/make_knock` blocking indefinitely when the room in question is a partial-stated room.
11 changes: 11 additions & 0 deletions synapse/federation/federation_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,17 @@ async def on_make_knock_request(
The partial knock event.
"""
origin_host, _ = parse_server_name(origin)

if await self.store.is_partial_state_room(room_id):
# Before we do anything: check if the room is partial-stated.
# Note that at the time this check was added, `on_make_knock_request` would
# block due to https://github.com/matrix-org/synapse/issues/12997.
raise SynapseError(
404,
"Unable to handle /make_knock right now; this server is not fully joined.",
errcode=Codes.NOT_FOUND,
)

await self.check_server_matches_acl(origin_host, room_id)

room_version = await self.store.get_room_version(room_id)
Expand Down

0 comments on commit ba882c0

Please sign in to comment.