Look up the right SRV record
This commit is contained in:
parent
e1c8440e0c
commit
afd69a0920
|
@ -0,0 +1 @@
|
||||||
|
Move SRV logic into the Agent layer
|
|
@ -101,7 +101,8 @@ class MatrixFederationAgent(object):
|
||||||
if port is not None:
|
if port is not None:
|
||||||
target = (host, port)
|
target = (host, port)
|
||||||
else:
|
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:
|
if not server_list:
|
||||||
target = (host, 8448)
|
target = (host, 8448)
|
||||||
logger.debug("No SRV record for %s, using %s", host, target)
|
logger.debug("No SRV record for %s, using %s", host, target)
|
||||||
|
|
|
@ -174,7 +174,9 @@ class MatrixFederationAgentTests(TestCase):
|
||||||
# Nothing happened yet
|
# Nothing happened yet
|
||||||
self.assertNoResult(test_d)
|
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
|
# Make sure treq is trying to connect
|
||||||
clients = self.reactor.tcpClients
|
clients = self.reactor.tcpClients
|
||||||
|
@ -212,7 +214,9 @@ class MatrixFederationAgentTests(TestCase):
|
||||||
# Nothing happened yet
|
# Nothing happened yet
|
||||||
self.assertNoResult(test_d)
|
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
|
# Make sure treq is trying to connect
|
||||||
clients = self.reactor.tcpClients
|
clients = self.reactor.tcpClients
|
||||||
|
@ -251,7 +255,9 @@ class MatrixFederationAgentTests(TestCase):
|
||||||
# Nothing happened yet
|
# Nothing happened yet
|
||||||
self.assertNoResult(test_d)
|
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
|
# Make sure treq is trying to connect
|
||||||
clients = self.reactor.tcpClients
|
clients = self.reactor.tcpClients
|
||||||
|
|
Loading…
Reference in New Issue