use upnp redirects if they're already set

This commit is contained in:
Jack 2016-08-03 01:27:40 -04:00
parent 6215d85581
commit 3af8b7bd0c

View file

@ -174,6 +174,7 @@ class LBRYSession(object):
log.info("Set UPnP redirect for TCP port %d", self.peer_port) log.info("Set UPnP redirect for TCP port %d", self.peer_port)
else: else:
log.warning("UPnP redirect already set for TCP port %d", self.peer_port) log.warning("UPnP redirect already set for TCP port %d", self.peer_port)
self.upnp_redirects.append((self.peer_port, 'TCP'))
if self.dht_node_port is not None: if self.dht_node_port is not None:
if u.getspecificportmapping(self.dht_node_port, 'UDP') is None: if u.getspecificportmapping(self.dht_node_port, 'UDP') is None:
u.addportmapping(self.dht_node_port, 'UDP', u.lanaddr, self.dht_node_port, 'LBRY DHT port', '') u.addportmapping(self.dht_node_port, 'UDP', u.lanaddr, self.dht_node_port, 'LBRY DHT port', '')
@ -181,6 +182,7 @@ class LBRYSession(object):
log.info("Set UPnP redirect for UPD port %d", self.dht_node_port) log.info("Set UPnP redirect for UPD port %d", self.dht_node_port)
else: else:
log.warning("UPnP redirect already set for UDP port %d", self.dht_node_port) log.warning("UPnP redirect already set for UDP port %d", self.dht_node_port)
self.upnp_redirects.append((self.dht_node_port, 'UDP'))
return True return True
return False return False