Refactor MatrixFederationAgent to retry SRV.

This refactors MatrixFederationAgent to move the SRV lookup into the
endpoint code, this has two benefits:
	1. Its easier to retry different host/ports in the same way as
	   HostnameEndpoint.
	2. We avoid SRV lookups if we have a free connection in the pool
This commit is contained in:
Erik Johnston 2019-08-08 15:30:04 +01:00
parent ce5f1cb98c
commit f299c5414c
4 changed files with 275 additions and 201 deletions

View file

@ -83,8 +83,10 @@ class SrvResolverTestCase(unittest.TestCase):
service_name = b"test_service.example.com"
entry = Mock(spec_set=["expires"])
entry = Mock(spec_set=["expires", "priority", "weight"])
entry.expires = 0
entry.priority = 0
entry.weight = 0
cache = {service_name: [entry]}
resolver = SrvResolver(dns_client=dns_client_mock, cache=cache)
@ -105,8 +107,10 @@ class SrvResolverTestCase(unittest.TestCase):
service_name = b"test_service.example.com"
entry = Mock(spec_set=["expires"])
entry = Mock(spec_set=["expires", "priority", "weight"])
entry.expires = 999999999
entry.priority = 0
entry.weight = 0
cache = {service_name: [entry]}
resolver = SrvResolver(