electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 10f037c40c5a6cedeba982da748937e5622762b3
parent 3d0e830734e70960074d3444430f3d1d6cf673b0
Author: ThomasV <thomasv@electrum.org>
Date:   Sun,  1 Jul 2018 21:58:59 +0200

Revert "socket.getaddrinfo on win32: do our own dns resolution outside the lock"

This reverts commit fc6cb70c809df52fbf8152fb0dfab7213faea49c.

Diffstat:
Mlib/network.py | 22+---------------------
1 file changed, 1 insertion(+), 21 deletions(-)

diff --git a/lib/network.py b/lib/network.py @@ -31,12 +31,8 @@ from collections import defaultdict import threading import socket import json -import sys -import dns -import dns.resolver import socks - from . import util from . import bitcoin from .bitcoin import COIN @@ -448,23 +444,7 @@ class Network(util.DaemonThread): socket.getaddrinfo = lambda *args: [(socket.AF_INET, socket.SOCK_STREAM, 6, '', (args[0], args[1]))] else: socket.socket = socket._socketobject - if sys.platform == 'win32': - # 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 - def fast_getaddrinfo(host, *args, **kwargs): - try: - if str(host) not in ('localhost', 'localhost.',): - answers = dns.resolver.query(host) - addr = str(answers[0]) - else: - addr = host - except: - raise socket.gaierror(11001, 'getaddrinfo failed') - else: - return socket._getaddrinfo(addr, *args, **kwargs) - socket.getaddrinfo = fast_getaddrinfo - else: - socket.getaddrinfo = socket._getaddrinfo + socket.getaddrinfo = socket._getaddrinfo @with_interface_lock def start_network(self, protocol, proxy):