summary refs log tree commit diff
diff options
context:
space:
mode:
authorZdziszek <132405081+zdzichu-rks@users.noreply.github.com>2023-05-05 14:54:32 +0000
committerGitHub <noreply@github.com>2023-05-05 15:54:32 +0100
commita0f53afd62273767b0f54f227fd0020f64c3f6de (patch)
treed930ed45429957fd0cf39c4b03d83ed7904f89ac
parentAdd `mdbook` to flake.nix (#15545) (diff)
downloadsynapse-a0f53afd62273767b0f54f227fd0020f64c3f6de.tar.xz
Handle `DNSNotImplementedError` in SRV resolver (#15523)
Signed-off-by: Zdzichu <zdzichu.rks@protonmail.com>
-rw-r--r--changelog.d/15523.bugfix1
-rw-r--r--synapse/http/federation/srv_resolver.py5
2 files changed, 5 insertions, 1 deletions
diff --git a/changelog.d/15523.bugfix b/changelog.d/15523.bugfix
new file mode 100644
index 0000000000..c00754019f
--- /dev/null
+++ b/changelog.d/15523.bugfix
@@ -0,0 +1 @@
+Don't fail on federation over TOR where SRV queries are not supported. Contributed by Zdzichu.
diff --git a/synapse/http/federation/srv_resolver.py b/synapse/http/federation/srv_resolver.py
index de0e882b33..285baddeb7 100644
--- a/synapse/http/federation/srv_resolver.py
+++ b/synapse/http/federation/srv_resolver.py
@@ -22,7 +22,7 @@ import attr
 
 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
 
@@ -145,6 +145,9 @@ class SrvResolver:
             # 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