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.
|
||||
|
||||
$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,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"])) {
|
||||
@@ -40,6 +41,10 @@ if (isset($_GET["new"])) {
|
||||
$port = intval($_GET["port"]);
|
||||
}
|
||||
$reachable = enet_probe($host, $port);
|
||||
}
|
||||
else {
|
||||
$reachable = true;
|
||||
}
|
||||
}
|
||||
|
||||
$dirname = dirname($state_file);
|
||||
|
||||
Reference in New Issue
Block a user