make FederationHandler.do_auth async

pull/6837/head
Richard van der Hoff 2020-02-03 15:51:24 +00:00
parent 8033b257a7
commit bc9b75c6f0
1 changed files with 14 additions and 10 deletions

View File

@ -2149,16 +2149,20 @@ class FederationHandler(BaseHandler):
return missing_events return missing_events
@defer.inlineCallbacks async def do_auth(
@log_function self,
def do_auth(self, origin, event, context, auth_events): origin: str,
event: EventBase,
context: EventContext,
auth_events: StateMap[EventBase],
) -> EventContext:
""" """
Args: Args:
origin (str): origin:
event (synapse.events.EventBase): event:
context (synapse.events.snapshot.EventContext): context:
auth_events (dict[(str, str)->synapse.events.EventBase]): auth_events:
Map from (event_type, state_key) to event Map from (event_type, state_key) to event
Normally, our calculated auth_events based on the state of the room Normally, our calculated auth_events based on the state of the room
@ -2168,13 +2172,13 @@ class FederationHandler(BaseHandler):
Also NB that this function adds entries to it. Also NB that this function adds entries to it.
Returns: Returns:
defer.Deferred[EventContext]: updated context object updated context object
""" """
room_version = yield self.store.get_room_version_id(event.room_id) room_version = await self.store.get_room_version_id(event.room_id)
room_version_obj = KNOWN_ROOM_VERSIONS[room_version] room_version_obj = KNOWN_ROOM_VERSIONS[room_version]
try: try:
context = yield self._update_auth_events_and_context_for_auth( context = await self._update_auth_events_and_context_for_auth(
origin, event, context, auth_events origin, event, context, auth_events
) )
except Exception: except Exception: