diff options
author | Matthew Hodgson <matthew@matrix.org> | 2016-04-07 17:26:44 +0100 |
---|---|---|
committer | Matthew Hodgson <matthew@matrix.org> | 2016-04-07 17:26:44 +0100 |
commit | d6e7333ae47feb1c31753dd2eebd09e42907218b (patch) | |
tree | 250363cd2d3460c01fb2ab1ad3652d5530446f82 /synapse/handlers/federation.py | |
parent | Merge branch 'develop' into matthew/preview_urls (diff) | |
parent | Merge pull request #704 from matrix-org/markh/slaveIII (diff) | |
download | synapse-d6e7333ae47feb1c31753dd2eebd09e42907218b.tar.xz |
Merge branch 'develop' into matthew/preview_urls
Diffstat (limited to 'synapse/handlers/federation.py')
-rw-r--r-- | synapse/handlers/federation.py | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py index adafd06b24..eb02f0e000 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py @@ -284,6 +284,9 @@ class FederationHandler(BaseHandler): def backfill(self, dest, room_id, limit, extremities=[]): """ Trigger a backfill request to `dest` for the given `room_id` """ + if dest == self.server_name: + raise SynapseError(400, "Can't backfill from self.") + if not extremities: extremities = yield self.store.get_oldest_events_in_room(room_id) @@ -450,7 +453,7 @@ class FederationHandler(BaseHandler): likely_domains = [ domain for domain, depth in curr_domains - if domain is not self.server_name + if domain != self.server_name ] @defer.inlineCallbacks @@ -784,13 +787,19 @@ class FederationHandler(BaseHandler): @defer.inlineCallbacks def do_remotely_reject_invite(self, target_hosts, room_id, user_id): - origin, event = yield self._make_and_verify_event( - target_hosts, - room_id, - user_id, - "leave" - ) - signed_event = self._sign_event(event) + try: + origin, event = yield self._make_and_verify_event( + target_hosts, + room_id, + user_id, + "leave" + ) + signed_event = self._sign_event(event) + except SynapseError: + raise + except CodeMessageException as e: + logger.warn("Failed to reject invite: %s", e) + raise SynapseError(500, "Failed to reject invite") # Try the host we successfully got a response to /make_join/ # request first. @@ -800,10 +809,16 @@ class FederationHandler(BaseHandler): except ValueError: pass - yield self.replication_layer.send_leave( - target_hosts, - signed_event - ) + try: + yield self.replication_layer.send_leave( + target_hosts, + signed_event + ) + except SynapseError: + raise + except CodeMessageException as e: + logger.warn("Failed to reject invite: %s", e) + raise SynapseError(500, "Failed to reject invite") context = yield self.state_handler.compute_event_context(event) |