Add a feature switch to reachability
This commit is contained in:
@@ -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.
|
$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.
|
$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.
|
||||||
|
|||||||
@@ -30,16 +30,21 @@ if ($error_reporting) {
|
|||||||
|
|
||||||
$reachable = false;
|
$reachable = false;
|
||||||
if (isset($_GET["new"])) {
|
if (isset($_GET["new"])) {
|
||||||
require "enet_probe.php";
|
if ($check_reachability) {
|
||||||
$host = $_SERVER['REMOTE_ADDR'];
|
require "enet_probe.php";
|
||||||
if (!empty($_GET["host"])) {
|
$host = $_SERVER['REMOTE_ADDR'];
|
||||||
$host = $_GET["host"];
|
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;
|
else {
|
||||||
if (!empty($_GET["port"]) && is_numeric($_GET["port"])) {
|
$reachable = true;
|
||||||
$port = intval($_GET["port"]);
|
|
||||||
}
|
}
|
||||||
$reachable = enet_probe($host, $port);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$dirname = dirname($state_file);
|
$dirname = dirname($state_file);
|
||||||
|
|||||||
Reference in New Issue
Block a user