windows dns hack: fix #6473
This commit is contained in:
@@ -32,8 +32,12 @@ def configure_dns_depending_on_proxy(is_proxy: bool) -> None:
|
|||||||
# On Windows, socket.getaddrinfo takes a mutex, and might hold it for up to 10 seconds
|
# On Windows, socket.getaddrinfo takes a mutex, and might hold it for up to 10 seconds
|
||||||
# when dns-resolving. To speed it up drastically, we resolve dns ourselves, outside that lock.
|
# when dns-resolving. To speed it up drastically, we resolve dns ourselves, outside that lock.
|
||||||
# See https://github.com/spesmilo/electrum/issues/4421
|
# See https://github.com/spesmilo/electrum/issues/4421
|
||||||
_prepare_windows_dns_hack()
|
try:
|
||||||
socket.getaddrinfo = _fast_getaddrinfo
|
_prepare_windows_dns_hack()
|
||||||
|
except Exception as e:
|
||||||
|
_logger.exception('failed to apply windows dns hack.')
|
||||||
|
else:
|
||||||
|
socket.getaddrinfo = _fast_getaddrinfo
|
||||||
else:
|
else:
|
||||||
socket.getaddrinfo = socket._getaddrinfo
|
socket.getaddrinfo = socket._getaddrinfo
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user