add ability to suppress masterserver pings via Settings (in prep for pchote's new UI magic for this)
This commit is contained in:
@@ -154,7 +154,7 @@ namespace OpenRA
|
|||||||
internal static void CreateServer()
|
internal static void CreateServer()
|
||||||
{
|
{
|
||||||
// todo: LobbyInfo is the wrong place for this.
|
// todo: LobbyInfo is the wrong place for this.
|
||||||
Server.Server.ServerMain(Settings.GameName, Settings.ListenPort,
|
Server.Server.ServerMain(Settings.InternetServer, Settings.GameName, Settings.ListenPort,
|
||||||
Settings.ExternalPort, LobbyInfo.GlobalSettings.Mods);
|
Settings.ExternalPort, LobbyInfo.GlobalSettings.Mods);
|
||||||
|
|
||||||
JoinServer(IPAddress.Loopback.ToString(), Settings.ListenPort);
|
JoinServer(IPAddress.Loopback.ToString(), Settings.ListenPort);
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ namespace OpenRA.GameRules
|
|||||||
public readonly string GameName = "OpenRA Game";
|
public readonly string GameName = "OpenRA Game";
|
||||||
public readonly int ListenPort = 1234;
|
public readonly int ListenPort = 1234;
|
||||||
public readonly int ExternalPort = 1234;
|
public readonly int ExternalPort = 1234;
|
||||||
|
public readonly bool InternetServer = true;
|
||||||
|
|
||||||
// Gameplay options
|
// Gameplay options
|
||||||
// TODO: These need to die
|
// TODO: These need to die
|
||||||
|
|||||||
@@ -50,9 +50,11 @@ namespace OpenRA.Server
|
|||||||
const int MasterPingInterval = 60 * 3; // 3 minutes. server has a 5 minute TTL for games, so give ourselves a bit
|
const int MasterPingInterval = 60 * 3; // 3 minutes. server has a 5 minute TTL for games, so give ourselves a bit
|
||||||
// of leeway.
|
// of leeway.
|
||||||
static int lastPing = 0;
|
static int lastPing = 0;
|
||||||
|
static bool isInternetServer;
|
||||||
|
|
||||||
public static void ServerMain(string name, int port, int extport, string[] mods)
|
public static void ServerMain(bool internetServer, string name, int port, int extport, string[] mods)
|
||||||
{
|
{
|
||||||
|
isInternetServer = internetServer;
|
||||||
listener = new TcpListener(IPAddress.Any, port);
|
listener = new TcpListener(IPAddress.Any, port);
|
||||||
initialMods = mods;
|
initialMods = mods;
|
||||||
Name = name;
|
Name = name;
|
||||||
@@ -556,7 +558,7 @@ namespace OpenRA.Server
|
|||||||
|
|
||||||
static void PingMasterServer()
|
static void PingMasterServer()
|
||||||
{
|
{
|
||||||
if (wc.IsBusy) return;
|
if (wc.IsBusy || !isInternetServer) return;
|
||||||
|
|
||||||
wc.DownloadDataAsync(new Uri(
|
wc.DownloadDataAsync(new Uri(
|
||||||
"http://open-ra.org/master/ping.php?port={0}&name={1}&state={2}&players={3}&mods={4}&map={5}".F(
|
"http://open-ra.org/master/ping.php?port={0}&name={1}&state={2}&players={3}&mods={4}&map={5}".F(
|
||||||
|
|||||||
Reference in New Issue
Block a user