Made sure that port 9090 could not be randomly selected.

This commit is contained in:
Jeff Baskin 2022-06-12 09:07:06 -04:00
parent e40e190e1e
commit e79cf82b62

View File

@ -30,7 +30,7 @@ class Server:
@property
def port(self):
"""Get the port of the server."""
port = 9090
port = "9090"
if "MTT_PORT" in self.env:
port = self.env["MTT_PORT"]
return port
@ -68,6 +68,7 @@ class Server:
def set_safe_port(self):
"""Set the server port to something not being used."""
while self.port == "9090":
sock = socket()
sock.bind((self.address, 0))
self.port = sock.getsockname()[1]