Browse Source

Exit more cleanly when ports are occupied

pull/911/head
Safihre 8 years ago
parent
commit
c9f765813c
  1. 9
      SABnzbd.py

9
SABnzbd.py

@ -669,7 +669,11 @@ def is_sabnzbd_running(url):
def find_free_port(host, currentport): def find_free_port(host, currentport):
""" Return a free port, 0 when nothing is free """ """ Return a free port if allowed, 0 when nothing is free """
if sabnzbd.cfg.fixed_ports():
# Port found before, so we bail out
raise IOError
n = 0 n = 0
while n < 10 and currentport <= 49151: while n < 10 and currentport <= 49151:
try: try:
@ -1042,9 +1046,6 @@ def main():
if url and check_for_sabnzbd(url, upload_nzbs, autobrowser): if url and check_for_sabnzbd(url, upload_nzbs, autobrowser):
exit_sab(0) exit_sab(0)
# We only performe the free-port check on first start-up
# because we want to be sure we can bind to something!
if not sabnzbd.cfg.fixed_ports():
# SSL # SSL
if enable_https: if enable_https:
port = https_port or cherryport port = https_port or cherryport

Loading…
Cancel
Save