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

Commit

Permalink
Use directory server for room joins (#3899)
Browse files Browse the repository at this point in the history
When we do a join, always try the server we used for the alias lookup first.

Fixes #2418
  • Loading branch information
richvdh authored Sep 18, 2018
1 parent 31c15dc commit a219ce8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/3899.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
When we join a room, always try the server we used for the alias lookup first, to avoid unresponsive and out-of-date servers.
5 changes: 5 additions & 0 deletions synapse/handlers/room_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,11 @@ def lookup_room_alias(self, room_alias):
room_id = mapping["room_id"]
servers = mapping["servers"]

# put the server which owns the alias at the front of the server list.
if room_alias.domain in servers:
servers.remove(room_alias.domain)
servers.insert(0, room_alias.domain)

defer.returnValue((RoomID.from_string(room_id), servers))

@defer.inlineCallbacks
Expand Down

0 comments on commit a219ce8

Please sign in to comment.