diff options
author | Erik Johnston <erik@matrix.org> | 2015-02-19 10:38:48 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2015-02-19 10:38:48 +0000 |
commit | 8321e8a2e0381f52f3f434223db58f6ea280d89e (patch) | |
tree | 13c5600cbeb56c7c2837dd2df329f10a239f91ac /synapse/crypto/keyring.py | |
parent | Merge pull request #73 from matrix-org/hotfixes-v0.7.0f (diff) | |
parent | Update release date (diff) | |
download | synapse-8321e8a2e0381f52f3f434223db58f6ea280d89e.tar.xz |
Merge branch 'release-v0.7.1' of github.com:matrix-org/synapse
Diffstat (limited to 'synapse/crypto/keyring.py')
-rw-r--r-- | synapse/crypto/keyring.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/synapse/crypto/keyring.py b/synapse/crypto/keyring.py index 3fb99f7125..828aced44a 100644 --- a/synapse/crypto/keyring.py +++ b/synapse/crypto/keyring.py @@ -22,6 +22,8 @@ from syutil.crypto.signing_key import ( from syutil.base64util import decode_base64, encode_base64 from synapse.api.errors import SynapseError, Codes +from synapse.util.retryutils import get_retry_limiter + from OpenSSL import crypto import logging @@ -87,12 +89,18 @@ class Keyring(object): return # Try to fetch the key from the remote server. - # TODO(markjh): Ratelimit requests to a given server. - (response, tls_certificate) = yield fetch_server_key( - server_name, self.hs.tls_context_factory + limiter = yield get_retry_limiter( + server_name, + self.clock, + self.store, ) + with limiter: + (response, tls_certificate) = yield fetch_server_key( + server_name, self.hs.tls_context_factory + ) + # Check the response. x509_certificate_bytes = crypto.dump_certificate( |