Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move ClientTLSOptionsFactory init out of refresh_certificates #4611

merged 3 commits into from Feb 11, 2019
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+9 −9
Diff settings


Just for now

Copy path View file
@@ -0,0 +1 @@
Move ClientTLSOptionsFactory init out of refresh_certificates
Copy path View file
@@ -216,9 +216,6 @@ def refresh_certificate(hs):"Loading certificate from disk...")
hs.tls_server_context_factory = context_factory.ServerContextFactory(hs.config)
hs.tls_client_options_factory = context_factory.ClientTLSOptionsFactory(
)"Certificate loaded.")

if hs._listening_services:
@@ -168,15 +168,15 @@ class MatrixFederationHttpClient(object):

def __init__(self, hs):
def __init__(self, hs, tls_client_options_factory):
self.hs = hs
self.signing_key = hs.config.signing_key[0]
self.server_name = hs.hostname
reactor = hs.get_reactor()

self.agent = MatrixFederationAgent(
self.clock = hs.get_clock()
self._store = hs.get_datastore()
Copy path View file
@@ -31,6 +31,7 @@
from synapse.api.ratelimiting import Ratelimiter
from synapse.appservice.api import ApplicationServiceApi
from synapse.appservice.scheduler import ApplicationServiceScheduler
from synapse.crypto import context_factory
from synapse.crypto.keyring import Keyring
from import EventBuilderFactory
from import SpamChecker
@@ -367,7 +368,10 @@ def build_pusherpool(self):
return PusherPool(self)

def build_http_client(self):
return MatrixFederationHttpClient(self)
tls_client_options_factory = context_factory.ClientTLSOptionsFactory(
return MatrixFederationHttpClient(self, tls_client_options_factory)

def build_db_pool(self):
name = self.db_config["name"]
Copy path View file
@@ -43,13 +43,11 @@ def check_logcontext(context):

class FederationClientTests(HomeserverTestCase):
def make_homeserver(self, reactor, clock):

hs = self.setup_test_homeserver(reactor=reactor, clock=clock)
hs.tls_client_options_factory = None
return hs

def prepare(self, reactor, clock, homeserver): = MatrixFederationHttpClient(self.hs) = MatrixFederationHttpClient(self.hs, None)
self.reactor.lookups["testserv"] = ""

def test_client_get(self):
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.