diff options
author | Richard van der Hoff <richard@matrix.org> | 2020-02-03 15:30:23 +0000 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2020-02-03 15:30:23 +0000 |
commit | b3e44f0bdf4caff4107826c63b9d281c4d9ff509 (patch) | |
tree | 11ef5c8d7cebffe72396ff5026622a09b5b0b650 | |
parent | Allow URL-encoded user IDs on user admin api paths (#6825) (diff) | |
download | synapse-b3e44f0bdf4caff4107826c63b9d281c4d9ff509.tar.xz |
make FederationHandler.on_query_auth async
-rw-r--r-- | synapse/handlers/federation.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py index c86d3177e9..61df39d4bf 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py @@ -2120,15 +2120,14 @@ class FederationHandler(BaseHandler): logger.warning("Soft-failing %r because %s", event, e) event.internal_metadata.soft_failed = True - @defer.inlineCallbacks - def on_query_auth( + async def on_query_auth( self, origin, event_id, room_id, remote_auth_chain, rejects, missing ): - in_room = yield self.auth.check_host_in_room(room_id, origin) + in_room = await self.auth.check_host_in_room(room_id, origin) if not in_room: raise AuthError(403, "Host not in room.") - event = yield self.store.get_event( + event = await self.store.get_event( event_id, allow_none=False, check_room_id=room_id ) @@ -2136,19 +2135,19 @@ class FederationHandler(BaseHandler): # don't want to fall into the trap of `missing` being wrong. for e in remote_auth_chain: try: - yield self._handle_new_event(origin, e) + await self._handle_new_event(origin, e) except AuthError: pass # Now get the current auth_chain for the event. - local_auth_chain = yield self.store.get_auth_chain( + local_auth_chain = await self.store.get_auth_chain( [auth_id for auth_id in event.auth_event_ids()], include_given=True ) # TODO: Check if we would now reject event_id. If so we need to tell # everyone. - ret = yield self.construct_auth_difference(local_auth_chain, remote_auth_chain) + ret = await self.construct_auth_difference(local_auth_chain, remote_auth_chain) logger.debug("on_query_auth returning: %s", ret) |