Fix enumerate_bootstrap_servers:
- in py27 socket.getaddrinfo() has no kwargs - in py3 socket.inet_aton() raises OSError if no IPv6
This commit is contained in:
parent
ae24a3b17d
commit
96c4b58c5e
|
@ -393,15 +393,17 @@ def start_proxyconfig():
|
||||||
|
|
||||||
|
|
||||||
def enumerate_bootstrap_servers():
|
def enumerate_bootstrap_servers():
|
||||||
"""Generator of (IP, port) pairs resolved from dns seeds"""
|
"""Generator of (IP, port) pairs resolved from DNS seeds"""
|
||||||
for port in [8080, 8444]:
|
for port in [8080, 8444]:
|
||||||
for item in socket.getaddrinfo(
|
for item in socket.getaddrinfo(
|
||||||
'bootstrap%s.bitmessage.org' % port, port, type=socket.SOCK_STREAM
|
# , type=socket.SOCK_STREAM
|
||||||
|
'bootstrap%s.bitmessage.org' % port, port
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
peer = item[4]
|
peer = item[4]
|
||||||
socket.inet_aton(peer[0])
|
socket.inet_aton(peer[0])
|
||||||
except (TypeError, socket.error):
|
except (OSError, TypeError, socket.error):
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
yield peer[:2]
|
if item[1] == socket.SOCK_STREAM: # only once each pair
|
||||||
|
yield peer[:2]
|
||||||
|
|
Reference in New Issue
Block a user