diff --git a/config.php.example b/config.php.example index 8c18ccd..4a2c024 100644 --- a/config.php.example +++ b/config.php.example @@ -5,3 +5,5 @@ $state_file = "state.json"; // The location for the state file. If it does not e $error_reporting = false; // Whether PHP errors should be shown. Not recommended for production. $lobby_timeout_seconds = 30; // How long it should take for unresponsive lobbies to get auto-delisted. + +$check_reachability = true; // Whether to reach out to the lobby listing host to confirm the lobby is reachable. diff --git a/index.php b/index.php index f8f0a13..614d5ab 100644 --- a/index.php +++ b/index.php @@ -30,16 +30,21 @@ if ($error_reporting) { $reachable = false; if (isset($_GET["new"])) { - require "enet_probe.php"; - $host = $_SERVER['REMOTE_ADDR']; - if (!empty($_GET["host"])) { - $host = $_GET["host"]; + if ($check_reachability) { + require "enet_probe.php"; + $host = $_SERVER['REMOTE_ADDR']; + if (!empty($_GET["host"])) { + $host = $_GET["host"]; + } + $port = 50403; + if (!empty($_GET["port"]) && is_numeric($_GET["port"])) { + $port = intval($_GET["port"]); + } + $reachable = enet_probe($host, $port); } - $port = 50403; - if (!empty($_GET["port"]) && is_numeric($_GET["port"])) { - $port = intval($_GET["port"]); + else { + $reachable = true; } - $reachable = enet_probe($host, $port); } $dirname = dirname($state_file);