Cache getPeer
This commit is contained in:
parent
cf94a78872
commit
d26b660aa6
|
@ -77,9 +77,12 @@ class SynapseKeyClientProtocol(HTTPClient):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.remote_key = defer.Deferred()
|
self.remote_key = defer.Deferred()
|
||||||
self.host = None
|
self.host = None
|
||||||
|
self._peer = None
|
||||||
|
|
||||||
def connectionMade(self):
|
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)
|
self.sendCommand(b"GET", self.path)
|
||||||
if self.host:
|
if self.host:
|
||||||
self.sendHeader(b"Host", self.host)
|
self.sendHeader(b"Host", self.host)
|
||||||
|
@ -125,7 +128,7 @@ class SynapseKeyClientProtocol(HTTPClient):
|
||||||
def on_timeout(self):
|
def on_timeout(self):
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"Timeout waiting for response from %s: %s",
|
"Timeout waiting for response from %s: %s",
|
||||||
self.host, self.transport.getPeer(),
|
self.host, self._peer,
|
||||||
)
|
)
|
||||||
self.errback(IOError("Timeout waiting for response"))
|
self.errback(IOError("Timeout waiting for response"))
|
||||||
self.transport.abortConnection()
|
self.transport.abortConnection()
|
||||||
|
|
Loading…
Reference in New Issue