commit 6709ec41174300093a5782debe2787f005bd9b07
parent 2d57a689d9bcf36799e1bfb9aa21bcd6a6d048a1
Author: SomberNight <somber.night@protonmail.com>
Date: Wed, 1 Jan 2020 06:23:51 +0100
dns hacks on windows: cache dns when using dnspython
related #4421
related #5337
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/electrum/network.py b/electrum/network.py
@@ -564,6 +564,9 @@ class Network(Logger):
# when dns-resolving. To speed it up drastically, we resolve dns ourselves, outside that lock.
# see #4421
socket.getaddrinfo = self._fast_getaddrinfo
+ resolver = dns.resolver.get_default_resolver()
+ if resolver.cache is None:
+ resolver.cache = dns.resolver.Cache()
else:
socket.getaddrinfo = socket._getaddrinfo
self.trigger_callback('proxy_set', self.proxy)