mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-22 22:23:36 -07:00
Attempt to start web server on next 5 ports
This commit is contained in:
parent
b4a25e33bb
commit
72e77c6b0f
2 changed files with 14 additions and 3 deletions
13
PlexPy.py
13
PlexPy.py
|
@ -176,7 +176,7 @@ def main():
|
||||||
"module to enable HTTPS. HTTPS will be disabled.")
|
"module to enable HTTPS. HTTPS will be disabled.")
|
||||||
plexpy.CONFIG.ENABLE_HTTPS = False
|
plexpy.CONFIG.ENABLE_HTTPS = False
|
||||||
|
|
||||||
# Try to start the server. Will exit here is address is already in use.
|
# Try to start the server on the next 5 ports. Will exit here is address is already in use.
|
||||||
web_config = {
|
web_config = {
|
||||||
'http_port': http_port,
|
'http_port': http_port,
|
||||||
'http_host': plexpy.CONFIG.HTTP_HOST,
|
'http_host': plexpy.CONFIG.HTTP_HOST,
|
||||||
|
@ -188,7 +188,16 @@ def main():
|
||||||
'http_username': plexpy.CONFIG.HTTP_USERNAME,
|
'http_username': plexpy.CONFIG.HTTP_USERNAME,
|
||||||
'http_password': plexpy.CONFIG.HTTP_PASSWORD,
|
'http_password': plexpy.CONFIG.HTTP_PASSWORD,
|
||||||
}
|
}
|
||||||
webstart.initialize(web_config)
|
web_start = False
|
||||||
|
while not web_start and web_config['http_port'] < http_port + 5:
|
||||||
|
web_start = webstart.initialize(web_config)
|
||||||
|
web_config['http_port'] += 1
|
||||||
|
|
||||||
|
if web_start:
|
||||||
|
http_port = web_config['http_port']
|
||||||
|
plexpy.CONFIG.HTTP_PORT = http_port
|
||||||
|
else:
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
# Start the background threads
|
# Start the background threads
|
||||||
plexpy.start()
|
plexpy.start()
|
||||||
|
|
|
@ -119,6 +119,8 @@ def initialize(options):
|
||||||
cherrypy.server.start()
|
cherrypy.server.start()
|
||||||
except IOError:
|
except IOError:
|
||||||
sys.stderr.write('Failed to start on port: %i. Is something else running?\n' % (options['http_port']))
|
sys.stderr.write('Failed to start on port: %i. Is something else running?\n' % (options['http_port']))
|
||||||
sys.exit(1)
|
return False
|
||||||
|
|
||||||
cherrypy.server.wait()
|
cherrypy.server.wait()
|
||||||
|
|
||||||
|
return True
|
Loading…
Add table
Add a link
Reference in a new issue