From 96c4b58c5e48d3c99a44fe1d4cbb3d378cccdbcf Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Mon, 1 Mar 2021 23:04:44 +0200 Subject: [PATCH] Fix enumerate_bootstrap_servers: - in py27 socket.getaddrinfo() has no kwargs - in py3 socket.inet_aton() raises OSError if no IPv6 --- src/helper_startup.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/helper_startup.py b/src/helper_startup.py index 23aea35c..27b35b6d 100644 --- a/src/helper_startup.py +++ b/src/helper_startup.py @@ -393,15 +393,17 @@ def start_proxyconfig(): 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 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: peer = item[4] socket.inet_aton(peer[0]) - except (TypeError, socket.error): + except (OSError, TypeError, socket.error): continue else: - yield peer[:2] + if item[1] == socket.SOCK_STREAM: # only once each pair + yield peer[:2]