summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-11-30 14:39:26 +0000
committerBrendan Abolivier <babolivier@matrix.org>2019-02-13 20:54:34 +0000
commitd85851bccacfade385faeba60d3d0daba3087c93 (patch)
tree5c5e8e963abbb62748740c2b9200398e5c444142
parentReduce send invite request size (diff)
downloadsynapse-d85851bccacfade385faeba60d3d0daba3087c93.tar.xz
Fix fetching media when using proxy
-rw-r--r--synapse/http/matrixfederationclient.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/synapse/http/matrixfederationclient.py b/synapse/http/matrixfederationclient.py

index ef5c71996c..211b800e9e 100644 --- a/synapse/http/matrixfederationclient.py +++ b/synapse/http/matrixfederationclient.py
@@ -213,6 +213,15 @@ class MatrixFederationHttpClient(object): self.agent = Agent.usingEndpointFactory( reactor, MatrixFederationEndpointFactory(hs), pool=pool ) + + file_pool = HTTPConnectionPool(reactor) + file_pool.retryAutomatically = False + file_pool.maxPersistentPerHost = 5 + file_pool.cachedConnectionTimeout = 10 + + self.file_agent = Agent.usingEndpointFactory( + reactor, MatrixFederationEndpointFactory(hs), pool=file_pool + ) self.clock = hs.get_clock() self._store = hs.get_datastore() self.version_string_bytes = hs.version_string.encode('ascii') @@ -231,7 +240,8 @@ class MatrixFederationHttpClient(object): timeout=None, long_retries=False, ignore_backoff=False, - backoff_on_404=False + backoff_on_404=False, + agent=None, ): """ Sends a request to the given server. @@ -724,6 +734,7 @@ class MatrixFederationHttpClient(object): request, retry_on_dns_fail=retry_on_dns_fail, ignore_backoff=ignore_backoff, + agent=self.file_agent, ) headers = dict(response.headers.getAllRawHeaders())