Commit 07d41e87 authored by Alexandre's avatar Alexandre
Browse files

Continue loop after a broken IP

parent 3266021d
......@@ -317,18 +317,23 @@ class ConnectionDoT(Connection):
addrinfo_list = socket.getaddrinfo(addr, 853, self.family)
addrinfo_set = { (addrinfo[4], addrinfo[0]) for addrinfo in addrinfo_list }
signal.signal(signal.SIGALRM, timeout_connection)
connection_success = False
self.success = False
for addrinfo in addrinfo_set:
self.hasher = hashlib.sha256()
if self.connect(addrinfo[0], addrinfo[1]):
connection_success = True
self.success = True
break
if self.verbose:
if self.verbose and connect is None:
print("Trying another IP address")
if not connection_success:
if self.verbose:
if not self.success:
if self.verbose and connect is None:
print("No other IP address")
error(f'Could not connect to "{server}"')
if connect is None:
error(f'Could not connect to "{server}"')
else:
if self.verbose:
print(f'Could not connect to "{server}" on {connect}')
def connect(self, addr, sock_family):
signal.alarm(TIMEOUT_CONN)
......@@ -906,6 +911,8 @@ for connectTo in ip_set:
error(f'Could not resolve "{url}"')
except CustomException as e:
error(e)
if conn.dot and not conn.success:
continue
if ifile is not None:
input = open(ifile)
if not check:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment