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

Handle DNSNotImplementedError in SRV resolver #15523

Merged
merged 3 commits into from May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/15523.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Don't fail on federation over TOR where SRV queries are not supported. Contributed by Zdzichu.
5 changes: 4 additions & 1 deletion synapse/http/federation/srv_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from twisted.internet.error import ConnectError
from twisted.names import client, dns
from twisted.names.error import DNSNameError, DomainError
from twisted.names.error import DNSNameError, DNSNotImplementedError, DomainError

from synapse.logging.context import make_deferred_yieldable

Expand Down Expand Up @@ -145,6 +145,9 @@ async def resolve_service(self, service_name: bytes) -> List[Server]:
# TODO: cache this. We can get the SOA out of the exception, and use
# the negative-TTL value.
return []
except DNSNotImplementedError:
# For .onion homeservers this is unavailable, just fallback to host:8448
return []
except DomainError as e:
# We failed to resolve the name (other than a NameError)
# Try something in the cache, else rereaise
Expand Down