1
0

Merge pull request #6837 from matrix-org/rav/federation_async

* commit 'c7d6d5c69': (27 commits)
  make FederationHandler.send_invite async
  make FederationHandler.on_get_missing_events async
  changelog
  make FederationHandler.user_joined_room async
  make FederationHandler._clean_room_for_join async
  make FederationHandler._notify_persisted_event async
  make FederationHandler.persist_events_and_notify async
  make FederationHandler._make_and_verify_event async
  make FederationHandler.do_remotely_reject_invite async
  make FederationHandler._check_for_soft_fail async
  make FederationHandler._persist_auth_tree async
  make FederationHandler.do_invite_join async
  make FederationHandler.on_event_auth async
  make FederationHandler.on_exchange_third_party_invite_request async
  make FederationHandler.construct_auth_difference async
  make FederationHandler._update_context_for_auth_events async
  make FederationHandler._update_auth_events_and_context_for_auth async
  make FederationHandler.do_auth async
  make FederationHandler._prep_event async
  make FederationHandler._handle_new_event async
  ...
This commit is contained in:
Andrew Morgan
2020-03-23 17:05:01 +00:00
4 changed files with 212 additions and 235 deletions

1
changelog.d/6837.misc Normal file
View File

@@ -0,0 +1 @@
Port much of `synapse.handlers.federation` to async/await.

File diff suppressed because it is too large Load Diff

View File

@@ -932,10 +932,9 @@ class EventCreationHandler(object):
# way? If we have been invited by a remote server, we need
# to get them to sign the event.
returned_invite = yield federation_handler.send_invite(
invitee.domain, event
returned_invite = yield defer.ensureDeferred(
federation_handler.send_invite(invitee.domain, event)
)
event.unsigned.pop("room_state", None)
# TODO: Make sure the signatures actually are correct.

View File

@@ -1029,8 +1029,10 @@ class RoomMemberMasterHandler(RoomMemberHandler):
# join dance for now, since we're kinda implicitly checking
# that we are allowed to join when we decide whether or not we
# need to do the invite/join dance.
yield self.federation_handler.do_invite_join(
remote_room_hosts, room_id, user.to_string(), content
yield defer.ensureDeferred(
self.federation_handler.do_invite_join(
remote_room_hosts, room_id, user.to_string(), content
)
)
yield self._user_joined_room(user, room_id)
@@ -1067,8 +1069,10 @@ class RoomMemberMasterHandler(RoomMemberHandler):
"""
fed_handler = self.federation_handler
try:
ret = yield fed_handler.do_remotely_reject_invite(
remote_room_hosts, room_id, target.to_string(), content=content,
ret = yield defer.ensureDeferred(
fed_handler.do_remotely_reject_invite(
remote_room_hosts, room_id, target.to_string(), content=content,
)
)
return ret
except Exception as e: