Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
1b64cb01
Commit
1b64cb01
authored
9 years ago
by
Erik Johnston
Browse files
Options
Downloads
Plain Diff
Merge branch 'erikj/perspective_limiter' into release-v0.11.1
parents
13130c2c
0eabfa55
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/crypto/keyring.py
+17
-21
17 additions, 21 deletions
synapse/crypto/keyring.py
synapse/http/matrixfederationclient.py
+4
-1
4 additions, 1 deletion
synapse/http/matrixfederationclient.py
with
21 additions
and
22 deletions
synapse/crypto/keyring.py
+
17
−
21
View file @
1b64cb01
...
@@ -381,28 +381,24 @@ class Keyring(object):
...
@@ -381,28 +381,24 @@ class Keyring(object):
def
get_server_verify_key_v2_indirect
(
self
,
server_names_and_key_ids
,
def
get_server_verify_key_v2_indirect
(
self
,
server_names_and_key_ids
,
perspective_name
,
perspective_name
,
perspective_keys
):
perspective_keys
):
limiter
=
yield
get_retry_limiter
(
# TODO(mark): Set the minimum_valid_until_ts to that needed by
perspective_name
,
self
.
clock
,
self
.
store
# the events being validated or the current time if validating
)
# an incoming request.
query_response
=
yield
self
.
client
.
post_json
(
with
limiter
:
destination
=
perspective_name
,
# TODO(mark): Set the minimum_valid_until_ts to that needed by
path
=
b
"
/_matrix/key/v2/query
"
,
# the events being validated or the current time if validating
data
=
{
# an incoming request.
u
"
server_keys
"
:
{
query_response
=
yield
self
.
client
.
post_json
(
server_name
:
{
destination
=
perspective_name
,
key_id
:
{
path
=
b
"
/_matrix/key/v2/query
"
,
u
"
minimum_valid_until_ts
"
:
0
data
=
{
}
for
key_id
in
key_ids
u
"
server_keys
"
:
{
server_name
:
{
key_id
:
{
u
"
minimum_valid_until_ts
"
:
0
}
for
key_id
in
key_ids
}
for
server_name
,
key_ids
in
server_names_and_key_ids
}
}
},
for
server_name
,
key_ids
in
server_names_and_key_ids
)
}
},
long_retries
=
True
,
)
keys
=
{}
keys
=
{}
...
...
This diff is collapsed.
Click to expand it.
synapse/http/matrixfederationclient.py
+
4
−
1
View file @
1b64cb01
...
@@ -302,7 +302,7 @@ class MatrixFederationHttpClient(object):
...
@@ -302,7 +302,7 @@ class MatrixFederationHttpClient(object):
defer
.
returnValue
(
json
.
loads
(
body
))
defer
.
returnValue
(
json
.
loads
(
body
))
@defer.inlineCallbacks
@defer.inlineCallbacks
def
post_json
(
self
,
destination
,
path
,
data
=
{}):
def
post_json
(
self
,
destination
,
path
,
data
=
{}
,
long_retries
=
True
):
"""
Sends the specifed json data using POST
"""
Sends the specifed json data using POST
Args:
Args:
...
@@ -311,6 +311,8 @@ class MatrixFederationHttpClient(object):
...
@@ -311,6 +311,8 @@ class MatrixFederationHttpClient(object):
path (str): The HTTP path.
path (str): The HTTP path.
data (dict): A dict containing the data that will be used as
data (dict): A dict containing the data that will be used as
the request body. This will be encoded as JSON.
the request body. This will be encoded as JSON.
long_retries (bool): A boolean that indicates whether we should
retry for a short or long time.
Returns:
Returns:
Deferred: Succeeds when we get a 2xx HTTP response. The result
Deferred: Succeeds when we get a 2xx HTTP response. The result
...
@@ -330,6 +332,7 @@ class MatrixFederationHttpClient(object):
...
@@ -330,6 +332,7 @@ class MatrixFederationHttpClient(object):
path
.
encode
(
"
ascii
"
),
path
.
encode
(
"
ascii
"
),
body_callback
=
body_callback
,
body_callback
=
body_callback
,
headers_dict
=
{
"
Content-Type
"
:
[
"
application/json
"
]},
headers_dict
=
{
"
Content-Type
"
:
[
"
application/json
"
]},
long_retries
=
True
,
)
)
if
200
<=
response
.
code
<
300
:
if
200
<=
response
.
code
<
300
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment