Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Add debug logging to DNS SRV requests. (#9305)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bubu authored Feb 3, 2021
1 parent 3f534d3 commit b0f4119
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/9305.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add debug logging for SRV lookups. Contributed by @Bubu.
7 changes: 7 additions & 0 deletions synapse/http/federation/matrix_federation_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,19 @@ async def _resolve_server(self) -> List[Server]:
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)]


Expand Down

0 comments on commit b0f4119

Please sign in to comment.