diff options
author | Erik Johnston <erik@matrix.org> | 2015-03-02 14:54:27 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-03-02 14:54:27 +0000 |
commit | b2d211847651414d67d4935683e32c76eb944029 (patch) | |
tree | 25ca81b14a72192a89c9399b3d80180ac124ca14 /synapse/handlers | |
parent | Merge pull request #83 from matrix-org/nofile_limit_config (diff) | |
parent | Merge branch 'develop' of github.com:matrix-org/synapse into batched_get_pdu (diff) | |
download | synapse-b2d211847651414d67d4935683e32c76eb944029.tar.xz |
Merge pull request #88 from matrix-org/batched_get_pdu
Batched get pdu
Diffstat (limited to 'synapse/handlers')
-rw-r--r-- | synapse/handlers/federation.py | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py index 7deed16f9c..ae4e9b316d 100644 --- a/synapse/handlers/federation.py +++ b/synapse/handlers/federation.py @@ -581,12 +581,13 @@ class FederationHandler(BaseHandler): defer.returnValue(event) @defer.inlineCallbacks - def get_state_for_pdu(self, origin, room_id, event_id): + def get_state_for_pdu(self, origin, room_id, event_id, do_auth=True): yield run_on_reactor() - in_room = yield self.auth.check_host_in_room(room_id, origin) - if not in_room: - raise AuthError(403, "Host not in room.") + if do_auth: + in_room = yield self.auth.check_host_in_room(room_id, origin) + if not in_room: + raise AuthError(403, "Host not in room.") state_groups = yield self.store.get_state_groups( [event_id] @@ -789,6 +790,29 @@ class FederationHandler(BaseHandler): defer.returnValue(ret) @defer.inlineCallbacks + def on_get_missing_events(self, origin, room_id, earliest_events, + latest_events, limit, min_depth): + in_room = yield self.auth.check_host_in_room( + room_id, + origin + ) + if not in_room: + raise AuthError(403, "Host not in room.") + + limit = min(limit, 20) + min_depth = max(min_depth, 0) + + missing_events = yield self.store.get_missing_events( + room_id=room_id, + earliest_events=earliest_events, + latest_events=latest_events, + limit=limit, + min_depth=min_depth, + ) + + defer.returnValue(missing_events) + + @defer.inlineCallbacks @log_function def do_auth(self, origin, event, context, auth_events): # Check if we have all the auth events. |