Fix undefined variable references when DNS timeouts.
This commit is contained in:
parent
c1357717d9
commit
e76d6a481f
1 changed files with 4 additions and 2 deletions
|
@ -412,7 +412,8 @@ class XMLStream(object):
|
||||||
except Socket.error:
|
except Socket.error:
|
||||||
log.debug("Could not open IPv%s socket." % proto)
|
log.debug("Could not open IPv%s socket." % proto)
|
||||||
except Socket.gaierror:
|
except Socket.gaierror:
|
||||||
log.warning("Socket could not be opened, wrong IP versions.")
|
log.warning("Socket could not be opened: no connectivity" + \
|
||||||
|
" or wrong IP versions.")
|
||||||
self.stop.set()
|
self.stop.set()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -923,6 +924,7 @@ class XMLStream(object):
|
||||||
items = [x for x in addresses.keys()]
|
items = [x for x in addresses.keys()]
|
||||||
items.sort()
|
items.sort()
|
||||||
|
|
||||||
|
address = (domain, port)
|
||||||
picked = random.randint(0, intmax)
|
picked = random.randint(0, intmax)
|
||||||
for item in items:
|
for item in items:
|
||||||
if picked <= item:
|
if picked <= item:
|
||||||
|
@ -930,8 +932,8 @@ class XMLStream(object):
|
||||||
break
|
break
|
||||||
for idx, answer in enumerate(self.dns_answers):
|
for idx, answer in enumerate(self.dns_answers):
|
||||||
if self.dns_answers[0] == address:
|
if self.dns_answers[0] == address:
|
||||||
|
self.dns_answers.pop(idx)
|
||||||
break
|
break
|
||||||
self.dns_answers.pop(idx)
|
|
||||||
log.debug("Trying to connect to %s:%s", *address)
|
log.debug("Trying to connect to %s:%s", *address)
|
||||||
return address
|
return address
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue