summary refs log tree commit diff
path: root/synapse/federation/federation_server.py
diff options
context:
space:
mode:
authorreivilibre <oliverw@matrix.org>2022-08-24 09:09:59 +0000
committerGitHub <noreply@github.com>2022-08-24 09:09:59 +0000
commitba882c03579e96a97568fca3551207690b302b30 (patch)
treee4d2dca9cfb16f6c1e567333456b4e9963442a51 /synapse/federation/federation_server.py
parentInstrument `_check_sigs_and_hash_and_fetch` to trace time spent in child conc... (diff)
downloadsynapse-ba882c03579e96a97568fca3551207690b302b30.tar.xz
Faster Room Joins: fix `/make_knock` blocking indefinitely when the room in question is a partial-stated room. (#13583)
Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
Diffstat (limited to '')
-rw-r--r--synapse/federation/federation_server.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/synapse/federation/federation_server.py b/synapse/federation/federation_server.py
index 75fbc6073d..3bf84cf625 100644
--- a/synapse/federation/federation_server.py
+++ b/synapse/federation/federation_server.py
@@ -763,6 +763,17 @@ class FederationServer(FederationBase):
             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)