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

Commit

Permalink
Handle DNSNotImplementedError in SRV resolver (#15523)
Browse files Browse the repository at this point in the history
Signed-off-by: Zdzichu <zdzichu.rks@protonmail.com>
  • Loading branch information
Zdziszek authored May 5, 2023
1 parent ad141ef commit a0f53af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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

0 comments on commit a0f53af

Please sign in to comment.