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

Commit

Permalink
Split FederationHandler in half (#10692)
Browse files Browse the repository at this point in the history
The idea here is to take anything to do with incoming events and move it out to a separate handler, as a way of making FederationHandler smaller.
  • Loading branch information
richvdh authored Aug 26, 2021
1 parent 96715d7 commit 1800aab
Show file tree
Hide file tree
Showing 11 changed files with 1,884 additions and 1,781 deletions.
1 change: 1 addition & 0 deletions changelog.d/10692.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Split the event-processing methods in `FederationHandler` into a separate `FederationEventHandler`.
7 changes: 5 additions & 2 deletions synapse/federation/federation_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def __init__(self, hs: "HomeServer"):
super().__init__(hs)

self.handler = hs.get_federation_handler()
self._federation_event_handler = hs.get_federation_event_handler()
self.state = hs.get_state_handler()
self._event_auth_handler = hs.get_event_auth_handler()

Expand Down Expand Up @@ -787,7 +788,9 @@ async def _on_send_membership_event(

event = await self._check_sigs_and_hash(room_version, event)

return await self.handler.on_send_membership_event(origin, event)
return await self._federation_event_handler.on_send_membership_event(
origin, event
)

async def on_event_auth(
self, origin: str, room_id: str, event_id: str
Expand Down Expand Up @@ -1005,7 +1008,7 @@ async def _process_incoming_pdus_in_room_inner(
async with lock:
logger.info("handling received PDU: %s", event)
try:
await self.handler.on_receive_pdu(origin, event)
await self._federation_event_handler.on_receive_pdu(origin, event)
except FederationError as e:
# XXX: Ideally we'd inform the remote we failed to process
# the event, but we can't return an error in the transaction
Expand Down
Loading

0 comments on commit 1800aab

Please sign in to comment.