Add debug logging to DNS SRV requests. (#9305)

This commit is contained in:
Marcus 2021-02-03 22:47:30 +01:00 committed by GitHub
parent 3f534d3fdf
commit b0f4119b8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

1
changelog.d/9305.misc Normal file
View file

@ -0,0 +1 @@
Add debug logging for SRV lookups. Contributed by @Bubu.

View file

@ -323,12 +323,19 @@ class MatrixHostnameEndpoint:
if port or _is_ip_literal(host):
return [Server(host, port or 8448)]
logger.debug("Looking up SRV record for %s", host.decode(errors="replace"))
server_list = await self._srv_resolver.resolve_service(b"_matrix._tcp." + host)
if server_list:
logger.debug(
"Got %s from SRV lookup for %s",
", ".join(map(str, server_list)),
host.decode(errors="replace"),
)
return server_list
# No SRV records, so we fallback to host and 8448
logger.debug("No SRV records for %s", host.decode(errors="replace"))
return [Server(host, 8448)]