diff options
author | Erik Johnston <erik@matrix.org> | 2014-11-14 11:46:07 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2014-11-14 11:46:07 +0000 |
commit | b8eca1ffbf697b968acd0e3abc0341ca134dc6a0 (patch) | |
tree | 64b1eb1540f1eff147fb58ac9e85fc64920a49ad /synapse/crypto/keyclient.py | |
parent | Use modelService to access room member power levels rather than RoomController. (diff) | |
parent | Merge branch 'develop' into request_logging (diff) | |
download | synapse-b8eca1ffbf697b968acd0e3abc0341ca134dc6a0.tar.xz |
Merge pull request #13 from matrix-org/request_logging
Request logging
Diffstat (limited to 'synapse/crypto/keyclient.py')
-rw-r--r-- | synapse/crypto/keyclient.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/synapse/crypto/keyclient.py b/synapse/crypto/keyclient.py index 5191be4570..bb1f400b54 100644 --- a/synapse/crypto/keyclient.py +++ b/synapse/crypto/keyclient.py @@ -18,6 +18,7 @@ from twisted.web.http import HTTPClient from twisted.internet.protocol import Factory from twisted.internet import defer, reactor from synapse.http.endpoint import matrix_endpoint +from synapse.util.logcontext import PreserveLoggingContext import json import logging @@ -36,10 +37,11 @@ def fetch_server_key(server_name, ssl_context_factory): for i in range(5): try: - protocol = yield endpoint.connect(factory) - server_response, server_certificate = yield protocol.remote_key - defer.returnValue((server_response, server_certificate)) - return + with PreserveLoggingContext(): + protocol = yield endpoint.connect(factory) + server_response, server_certificate = yield protocol.remote_key + defer.returnValue((server_response, server_certificate)) + return except Exception as e: logger.exception(e) raise IOError("Cannot get key for %s" % server_name) |