mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-19 05:14:18 -05:00
Fix federated joins when the first server in the list is not in the room (#15074)
Previously we would give up upon receiving a 404 from the first server, instead of trying the rest of the servers in the list. Signed-off-by: Sean Quah <seanq@matrix.org>
This commit is contained in:
parent
39795b3a4e
commit
3ad817bfe5
1
changelog.d/15074.bugfix
Normal file
1
changelog.d/15074.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fix a long-standing bug where federated joins would fail if the first server in the list of servers to try is not in the room.
|
@ -884,7 +884,7 @@ class FederationClient(FederationBase):
|
|||||||
if 500 <= e.code < 600:
|
if 500 <= e.code < 600:
|
||||||
failover = True
|
failover = True
|
||||||
|
|
||||||
elif e.code == 400 and synapse_error.errcode in failover_errcodes:
|
elif 400 <= e.code < 500 and synapse_error.errcode in failover_errcodes:
|
||||||
failover = True
|
failover = True
|
||||||
|
|
||||||
elif failover_on_unknown_endpoint and self._is_unknown_endpoint(
|
elif failover_on_unknown_endpoint and self._is_unknown_endpoint(
|
||||||
@ -999,14 +999,13 @@ class FederationClient(FederationBase):
|
|||||||
|
|
||||||
return destination, ev, room_version
|
return destination, ev, room_version
|
||||||
|
|
||||||
|
failover_errcodes = {Codes.NOT_FOUND}
|
||||||
# MSC3083 defines additional error codes for room joins. Unfortunately
|
# MSC3083 defines additional error codes for room joins. Unfortunately
|
||||||
# we do not yet know the room version, assume these will only be returned
|
# we do not yet know the room version, assume these will only be returned
|
||||||
# by valid room versions.
|
# by valid room versions.
|
||||||
failover_errcodes = (
|
if membership == Membership.JOIN:
|
||||||
(Codes.UNABLE_AUTHORISE_JOIN, Codes.UNABLE_TO_GRANT_JOIN)
|
failover_errcodes.add(Codes.UNABLE_AUTHORISE_JOIN)
|
||||||
if membership == Membership.JOIN
|
failover_errcodes.add(Codes.UNABLE_TO_GRANT_JOIN)
|
||||||
else None
|
|
||||||
)
|
|
||||||
|
|
||||||
return await self._try_destination_list(
|
return await self._try_destination_list(
|
||||||
"make_" + membership,
|
"make_" + membership,
|
||||||
|
Loading…
Reference in New Issue
Block a user