Rev3408, Use fixed 15441 port in tor always mode

This commit is contained in:
shortcutme 2018-04-06 18:18:10 +02:00
parent 59c6ee7ade
commit d4a1764d20
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
2 changed files with 7 additions and 4 deletions

View file

@ -25,8 +25,10 @@ class FileServer(ConnectionServer):
self.log = logging.getLogger("FileServer")
ip = ip.replace("*", "0.0.0.0")
should_use_random_port = port == 0 or config.tor == "always"
if should_use_random_port:
if config.tor == "always":
port = config.tor_hs_port
config.fileserver_port = port
elif port == 0: # Use random port
port_range_from, port_range_to = map(int, config.fileserver_port_range.split("-"))
port = self.getRandomPort(ip, port_range_from, port_range_to)
config.fileserver_port = port