Browse Source

Always log the exact IP-address we are connecting to

Closes #1764
tags/3.2.0Beta2
Safihre 4 years ago
parent
commit
283e643606
  1. 41
      sabnzbd/downloader.py

41
sabnzbd/downloader.py

@ -124,29 +124,26 @@ class Server:
logging.debug("%s: Re-using address %s", self.host, self.busy_threads[0].nntp.host) logging.debug("%s: Re-using address %s", self.host, self.busy_threads[0].nntp.host)
return self.busy_threads[0].nntp.host return self.busy_threads[0].nntp.host
# Determine new IP # Determine IP
if cfg.load_balancing() == 0 and self.info: ip = self.host
# Just return the first one, so all next threads use the same IP if self.info:
ip = self.info[0][4][0] if cfg.load_balancing() == 0 or len(self.info) == 1:
logging.debug("%s: Connecting to address %s", self.host, ip) # Just return the first one, so all next threads use the same IP
ip = self.info[0][4][0]
elif cfg.load_balancing() == 1 and self.info and len(self.info) > 1:
# Return a random entry from the possible IPs
rnd = random.randint(0, len(self.info) - 1)
ip = self.info[rnd][4][0]
logging.debug("%s: Connecting to address %s", self.host, ip)
elif cfg.load_balancing() == 2 and self.info and len(self.info) > 1:
# RFC6555 / Happy Eyeballs:
ip = happyeyeballs(self.host, port=self.port, ssl=self.ssl)
if ip:
logging.debug("%s: Connecting to address %s", self.host, ip) logging.debug("%s: Connecting to address %s", self.host, ip)
else: elif cfg.load_balancing() == 1:
# nothing returned, so there was a connection problem # Return a random entry from the possible IPs
ip = self.host rnd = random.randint(0, len(self.info) - 1)
logging.debug("%s: No successful IP connection was possible", self.host) ip = self.info[rnd][4][0]
else: logging.debug("%s: Connecting to address %s", self.host, ip)
ip = self.host elif cfg.load_balancing() == 2:
# RFC6555 / Happy Eyeballs:
ip = happyeyeballs(self.host, port=self.port, ssl=self.ssl)
if ip:
logging.debug("%s: Connecting to address %s", self.host, ip)
else:
# nothing returned, so there was a connection problem
logging.debug("%s: No successful IP connection was possible", self.host)
return ip return ip
def stop(self): def stop(self):

Loading…
Cancel
Save