summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/directory.py11
-rw-r--r--synapse/handlers/federation.py4
2 files changed, 12 insertions, 3 deletions
diff --git a/synapse/handlers/directory.py b/synapse/handlers/directory.py
index 58e9a91562..7b60921040 100644
--- a/synapse/handlers/directory.py
+++ b/synapse/handlers/directory.py
@@ -113,7 +113,16 @@ class DirectoryHandler(BaseHandler):
             )
 
         extra_servers = yield self.store.get_joined_hosts_for_room(room_id)
-        servers = list(set(extra_servers) | set(servers))
+        servers = set(extra_servers) | set(servers)
+
+        # If this server is in the list of servers, return it first.
+        if self.server_name in servers:
+            servers = (
+                [self.server_name]
+                + [s for s in servers if s != self.server_name]
+            )
+        else:
+            servers = list(servers)
 
         defer.returnValue({
             "room_id": room_id,
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 2e2c23ef63..04a4689483 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -288,7 +288,7 @@ class FederationHandler(BaseHandler):
         logger.debug("Joining %s to %s", joinee, room_id)
 
         pdu = yield self.replication_layer.make_join(
-            target_host,
+            [target_host],
             room_id,
             joinee
         )
@@ -331,7 +331,7 @@ class FederationHandler(BaseHandler):
             new_event = builder.build()
 
             ret = yield self.replication_layer.send_join(
-                target_host,
+                [target_host],
                 new_event
             )