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

Clarifications in FederationHandler #3967

Merged
merged 3 commits into from
Sep 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/3967.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Clarifications in FederationHandler
2 changes: 0 additions & 2 deletions synapse/federation/federation_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,6 @@ def get_pdu(self, destinations, event_id, outlier=False, timeout=None):
Will attempt to get the PDU from each destination in the list until
one succeeds.

This will persist the PDU locally upon receipt.

Args:
destinations (list): Which home servers to query
event_id (str): event to fetch
Expand Down
12 changes: 10 additions & 2 deletions synapse/handlers/federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,22 @@ def on_receive_pdu(
)

with logcontext.nested_logging_context(p):
state, got_auth_chain = (
# note that if any of the missing prevs share missing state or
# auth events, the requests to fetch those events are deduped
# by the get_pdu_cache in federation_client.
remote_state, got_auth_chain = (
yield self.federation_client.get_state_for_room(
origin, room_id, p,
)
)

# XXX hrm I'm not convinced that duplicate events will compare
# for equality, so I'm not sure this does what the author
# hoped.
auth_chains.update(got_auth_chain)

state_group = {
(x.type, x.state_key): x.event_id for x in state
(x.type, x.state_key): x.event_id for x in remote_state
}
state_groups.append(state_group)

Expand Down