make FederationHandler.on_send_join_request async

This commit is contained in:
Richard van der Hoff 2020-02-03 15:32:48 +00:00
parent b3e44f0bdf
commit 7571bf86f0

View File

@ -1411,9 +1411,7 @@ class FederationHandler(BaseHandler):
return event return event
@defer.inlineCallbacks async def on_send_join_request(self, origin, pdu):
@log_function
def on_send_join_request(self, origin, pdu):
""" We have received a join event for a room. Fully process it and """ We have received a join event for a room. Fully process it and
respond with the current state and auth chains. respond with the current state and auth chains.
""" """
@ -1450,9 +1448,9 @@ class FederationHandler(BaseHandler):
# would introduce the danger of backwards-compatibility problems. # would introduce the danger of backwards-compatibility problems.
event.internal_metadata.send_on_behalf_of = origin event.internal_metadata.send_on_behalf_of = origin
context = yield self._handle_new_event(origin, event) context = await self._handle_new_event(origin, event)
event_allowed = yield self.third_party_event_rules.check_event_allowed( event_allowed = await self.third_party_event_rules.check_event_allowed(
event, context event, context
) )
if not event_allowed: if not event_allowed:
@ -1470,14 +1468,14 @@ class FederationHandler(BaseHandler):
if event.type == EventTypes.Member: if event.type == EventTypes.Member:
if event.content["membership"] == Membership.JOIN: if event.content["membership"] == Membership.JOIN:
user = UserID.from_string(event.state_key) user = UserID.from_string(event.state_key)
yield self.user_joined_room(user, event.room_id) await self.user_joined_room(user, event.room_id)
prev_state_ids = yield context.get_prev_state_ids() prev_state_ids = await context.get_prev_state_ids()
state_ids = list(prev_state_ids.values()) state_ids = list(prev_state_ids.values())
auth_chain = yield self.store.get_auth_chain(state_ids) auth_chain = await self.store.get_auth_chain(state_ids)
state = yield self.store.get_events(list(prev_state_ids.values())) state = await self.store.get_events(list(prev_state_ids.values()))
return {"state": list(state.values()), "auth_chain": auth_chain} return {"state": list(state.values()), "auth_chain": auth_chain}