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

Commit 1800aab

Browse files
authored
Split FederationHandler in half (#10692)
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.
1 parent 96715d7 commit 1800aab

File tree

11 files changed

+1884
-1781
lines changed

11 files changed

+1884
-1781
lines changed

changelog.d/10692.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Split the event-processing methods in `FederationHandler` into a separate `FederationEventHandler`.

synapse/federation/federation_server.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def __init__(self, hs: "HomeServer"):
110110
super().__init__(hs)
111111

112112
self.handler = hs.get_federation_handler()
113+
self._federation_event_handler = hs.get_federation_event_handler()
113114
self.state = hs.get_state_handler()
114115
self._event_auth_handler = hs.get_event_auth_handler()
115116

@@ -787,7 +788,9 @@ async def _on_send_membership_event(
787788

788789
event = await self._check_sigs_and_hash(room_version, event)
789790

790-
return await self.handler.on_send_membership_event(origin, event)
791+
return await self._federation_event_handler.on_send_membership_event(
792+
origin, event
793+
)
791794

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

0 commit comments

Comments
 (0)