summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-07-21 17:38:51 +0100
committerErik Johnston <erik@matrix.org>2016-07-21 17:38:51 +0100
commitd26b660aa6580b1947f04f7efd598d34a259b970 (patch)
tree8d6b7e9049aeeb12805793a75934b3046e5100c9
parentSet host not path (diff)
downloadsynapse-d26b660aa6580b1947f04f7efd598d34a259b970.tar.xz
Cache getPeer
Diffstat (limited to '')
-rw-r--r--synapse/crypto/keyclient.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/crypto/keyclient.py b/synapse/crypto/keyclient.py
index 1d85990369..c2bd64d6c2 100644
--- a/synapse/crypto/keyclient.py
+++ b/synapse/crypto/keyclient.py
@@ -77,9 +77,12 @@ class SynapseKeyClientProtocol(HTTPClient):
     def __init__(self):
         self.remote_key = defer.Deferred()
         self.host = None
+        self._peer = None
 
     def connectionMade(self):
-        logger.debug("Connected to %s", self.transport.getPeer())
+        self._peer = self.transport.getPeer()
+        logger.debug("Connected to %s", self._peer)
+
         self.sendCommand(b"GET", self.path)
         if self.host:
             self.sendHeader(b"Host", self.host)
@@ -125,7 +128,7 @@ class SynapseKeyClientProtocol(HTTPClient):
     def on_timeout(self):
         logger.debug(
             "Timeout waiting for response from %s: %s",
-            self.host, self.transport.getPeer(),
+            self.host, self._peer,
         )
         self.errback(IOError("Timeout waiting for response"))
         self.transport.abortConnection()