Add a feature switch to reachability

This commit is contained in:
2026-08-03 21:02:31 +02:00
parent 51d76cd451
commit 781c6047ca
2 changed files with 15 additions and 8 deletions
+2
View File
@@ -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.
+5
View File
@@ -30,6 +30,7 @@ if ($error_reporting) {
$reachable = false;
if (isset($_GET["new"])) {
if ($check_reachability) {
require "enet_probe.php";
$host = $_SERVER['REMOTE_ADDR'];
if (!empty($_GET["host"])) {
@@ -41,6 +42,10 @@ if (isset($_GET["new"])) {
}
$reachable = enet_probe($host, $port);
}
else {
$reachable = true;
}
}
$dirname = dirname($state_file);
if (!is_dir($dirname)) {