mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-23 10:05:55 +03:00
Pull inner function out.
This commit is contained in:
parent
e701aec2d1
commit
0a016b0525
1 changed files with 78 additions and 77 deletions
|
@ -101,8 +101,23 @@ class Keyring(object):
|
|||
defer.returnValue(cached[0])
|
||||
return
|
||||
|
||||
download = self.key_downloads.get(server_name)
|
||||
|
||||
if download is None:
|
||||
download = self._get_server_verify_key_impl(server_name, key_ids)
|
||||
self.key_downloads[server_name] = download
|
||||
|
||||
@download.addBoth
|
||||
def callback(ret):
|
||||
del self.key_downloads[server_name]
|
||||
return ret
|
||||
|
||||
r = yield create_observer(download)
|
||||
defer.returnValue(r)
|
||||
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def fetch_keys():
|
||||
def _get_server_verify_key_impl(self, server_name, key_ids):
|
||||
# Try to fetch the key from the remote server.
|
||||
|
||||
limiter = yield get_retry_limiter(
|
||||
|
@ -176,17 +191,3 @@ class Keyring(object):
|
|||
return
|
||||
|
||||
raise ValueError("No verification key found for given key ids")
|
||||
|
||||
download = self.key_downloads.get(server_name)
|
||||
|
||||
if download is None:
|
||||
download = fetch_keys()
|
||||
self.key_downloads[server_name] = download
|
||||
|
||||
@download.addBoth
|
||||
def callback(ret):
|
||||
del self.key_downloads[server_name]
|
||||
return ret
|
||||
|
||||
r = yield create_observer(download)
|
||||
defer.returnValue(r)
|
||||
|
|
Loading…
Reference in a new issue