mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-22 01:25:44 +03:00
Look up the right SRV record
This commit is contained in:
parent
e1c8440e0c
commit
afd69a0920
3 changed files with 12 additions and 4 deletions
1
changelog.d/4464.misc
Normal file
1
changelog.d/4464.misc
Normal file
|
@ -0,0 +1 @@
|
|||
Move SRV logic into the Agent layer
|
|
@ -101,7 +101,8 @@ class MatrixFederationAgent(object):
|
|||
if port is not None:
|
||||
target = (host, port)
|
||||
else:
|
||||
server_list = yield self._srv_resolver.resolve_service(server_name_bytes)
|
||||
service_name = b"_matrix._tcp.%s" % (server_name_bytes, )
|
||||
server_list = yield self._srv_resolver.resolve_service(service_name)
|
||||
if not server_list:
|
||||
target = (host, 8448)
|
||||
logger.debug("No SRV record for %s, using %s", host, target)
|
||||
|
|
|
@ -174,7 +174,9 @@ class MatrixFederationAgentTests(TestCase):
|
|||
# Nothing happened yet
|
||||
self.assertNoResult(test_d)
|
||||
|
||||
self.mock_resolver.resolve_service.assert_called_once()
|
||||
self.mock_resolver.resolve_service.assert_called_once_with(
|
||||
b"_matrix._tcp.1.2.3.4",
|
||||
)
|
||||
|
||||
# Make sure treq is trying to connect
|
||||
clients = self.reactor.tcpClients
|
||||
|
@ -212,7 +214,9 @@ class MatrixFederationAgentTests(TestCase):
|
|||
# Nothing happened yet
|
||||
self.assertNoResult(test_d)
|
||||
|
||||
self.mock_resolver.resolve_service.assert_called_once()
|
||||
self.mock_resolver.resolve_service.assert_called_once_with(
|
||||
b"_matrix._tcp.testserv",
|
||||
)
|
||||
|
||||
# Make sure treq is trying to connect
|
||||
clients = self.reactor.tcpClients
|
||||
|
@ -251,7 +255,9 @@ class MatrixFederationAgentTests(TestCase):
|
|||
# Nothing happened yet
|
||||
self.assertNoResult(test_d)
|
||||
|
||||
self.mock_resolver.resolve_service.assert_called_once()
|
||||
self.mock_resolver.resolve_service.assert_called_once_with(
|
||||
b"_matrix._tcp.testserv",
|
||||
)
|
||||
|
||||
# Make sure treq is trying to connect
|
||||
clients = self.reactor.tcpClients
|
||||
|
|
Loading…
Reference in a new issue