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/federation/transport/server.py | |
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/federation/transport/server.py')
-rw-r--r-- | synapse/federation/transport/server.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/synapse/federation/transport/server.py b/synapse/federation/transport/server.py index fce9c0195e..ece6dbcf62 100644 --- a/synapse/federation/transport/server.py +++ b/synapse/federation/transport/server.py @@ -242,6 +242,7 @@ class TransportLayerServer(object): ) ) ) + self.server.register_path( "POST", re.compile("^" + PREFIX + "/query_auth/([^/]*)/([^/]*)$"), @@ -253,6 +254,17 @@ class TransportLayerServer(object): ) ) + self.server.register_path( + "POST", + re.compile("^" + PREFIX + "/get_missing_events/([^/]*)/?$"), + self._with_authentication( + lambda origin, content, query, room_id: + self._get_missing_events( + origin, content, room_id, + ) + ) + ) + @defer.inlineCallbacks @log_function def _on_send_request(self, origin, content, query, transaction_id): @@ -352,3 +364,22 @@ class TransportLayerServer(object): ) defer.returnValue((200, new_content)) + + @defer.inlineCallbacks + @log_function + def _get_missing_events(self, origin, content, room_id): + limit = int(content.get("limit", 10)) + min_depth = int(content.get("min_depth", 0)) + earliest_events = content.get("earliest_events", []) + latest_events = content.get("latest_events", []) + + content = yield self.request_handler.on_get_missing_events( + origin, + room_id=room_id, + earliest_events=earliest_events, + latest_events=latest_events, + min_depth=min_depth, + limit=limit, + ) + + defer.returnValue((200, content)) |