diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2018-09-18 18:27:37 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-18 18:27:37 +0100 |
commit | a219ce87263ad9be887cf039a04b4a1f06b7b0b8 (patch) | |
tree | 3e7c239e0f82bdf5ffc9b085e7de1f59b6f33486 | |
parent | Refactor matrixfederationclient to fix logging (#3906) (diff) | |
download | synapse-a219ce87263ad9be887cf039a04b4a1f06b7b0b8.tar.xz |
Use directory server for room joins (#3899)
When we do a join, always try the server we used for the alias lookup first. Fixes #2418
-rw-r--r-- | changelog.d/3899.bugfix | 1 | ||||
-rw-r--r-- | synapse/handlers/room_member.py | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/changelog.d/3899.bugfix b/changelog.d/3899.bugfix new file mode 100644 index 0000000000..5120e3a823 --- /dev/null +++ b/changelog.d/3899.bugfix @@ -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. diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py index f643619047..07fd3e82fc 100644 --- a/synapse/handlers/room_member.py +++ b/synapse/handlers/room_member.py @@ -583,6 +583,11 @@ class RoomMemberHandler(object): 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 |