- Added better fallback to default port range when a custom range fails

- Updated config to be clearer
This commit is contained in:
Lexipherous
2023-09-09 14:40:52 +01:00
parent 354c9aea4c
commit 392a45ec89
2 changed files with 10 additions and 0 deletions

View File

@@ -146,6 +146,15 @@ def get_random_port(game_ports):
available_ports.append(int(item))
port = get_port_from_list(available_ports)
if port == 0:
logging.info("Unable to find port. Expanding search to the default ports. (49152-65535)")
checked_ports = []
while len(set(checked_ports)) < (65535-49152)+1:
port = random.randint(49152, 65535)
if not is_port_in_use(port):
break
else:
checked_ports.append(port)
return port

View File

@@ -19,6 +19,7 @@
# Ports used for game hosting. Values can be specific ports, port ranges or both. Default is: "49152-65535"
# Examples of valid values: "40000-41000,49152-65535"
# If ports within the range(s) are already in use, the WebHost will fallback to the default "49152-65535" range.
#GAME_PORTS: "49152-65535"
# Place where uploads go.