diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2022-02-17 16:11:59 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-17 16:11:59 +0000 |
commit | da0e9f8efdac1571eab35ad2cc842073ca54769c (patch) | |
tree | 75824b2f9e0c9b1ba5eb8f943b21b13a411044ec /synapse/federation/federation_client.py | |
parent | Configure `tox` to use `venv` (#12015) (diff) | |
download | synapse-da0e9f8efdac1571eab35ad2cc842073ca54769c.tar.xz |
Faster joins: parse msc3706 fields in send_join response (#12011)
Part of my work on #11249: add code to handle the new fields added in MSC3706.
Diffstat (limited to 'synapse/federation/federation_client.py')
-rw-r--r-- | synapse/federation/federation_client.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/synapse/federation/federation_client.py b/synapse/federation/federation_client.py index 74f17aa4da..9f56f97d99 100644 --- a/synapse/federation/federation_client.py +++ b/synapse/federation/federation_client.py @@ -1,4 +1,4 @@ -# Copyright 2015-2021 The Matrix.org Foundation C.I.C. +# Copyright 2015-2022 The Matrix.org Foundation C.I.C. # Copyright 2020 Sorunome # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -89,6 +89,12 @@ class SendJoinResult: state: List[EventBase] auth_chain: List[EventBase] + # True if 'state' elides non-critical membership events + partial_state: bool + + # if 'partial_state' is set, a list of the servers in the room (otherwise empty) + servers_in_room: List[str] + class FederationClient(FederationBase): def __init__(self, hs: "HomeServer"): @@ -876,11 +882,18 @@ class FederationClient(FederationBase): % (auth_chain_create_events,) ) + if response.partial_state and not response.servers_in_room: + raise InvalidResponseError( + "partial_state was set, but no servers were listed in the room" + ) + return SendJoinResult( event=event, state=signed_state, auth_chain=signed_auth, origin=destination, + partial_state=response.partial_state, + servers_in_room=response.servers_in_room or [], ) # MSC3083 defines additional error codes for room joins. |