Added try/catch to public ip. Added individual server stats on LB stats
This commit is contained in:
parent
3b17246764
commit
de70322c4f
3 changed files with 14 additions and 1 deletions
|
|
@ -24,6 +24,7 @@ namespace LightReflectiveMirror.LoadBalancing
|
||||||
public TimeSpan uptime;
|
public TimeSpan uptime;
|
||||||
public long CCU;
|
public long CCU;
|
||||||
public long totalServerCount;
|
public long totalServerCount;
|
||||||
|
public List<KeyValuePair<RelayAddress, RelayServerInfo>> connectedNodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// container for relay address info
|
// container for relay address info
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace LightReflectiveMirror.LoadBalancing
|
namespace LightReflectiveMirror.LoadBalancing
|
||||||
{
|
{
|
||||||
public partial class Endpoint
|
public partial class Endpoint
|
||||||
|
|
@ -22,6 +24,7 @@ namespace LightReflectiveMirror.LoadBalancing
|
||||||
uptime = DateTime.Now - Program.startupTime,
|
uptime = DateTime.Now - Program.startupTime,
|
||||||
CCU = Program.instance.GetTotalCCU(),
|
CCU = Program.instance.GetTotalCCU(),
|
||||||
totalServerCount = Program.instance.GetTotalServers(),
|
totalServerCount = Program.instance.GetTotalServers(),
|
||||||
|
connectedNodes = Program.instance.availableRelayServers.ToList()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,16 @@ namespace LightReflectiveMirror
|
||||||
instance = this;
|
instance = this;
|
||||||
_startupTime = DateTime.Now;
|
_startupTime = DateTime.Now;
|
||||||
using (WebClient wc = new WebClient())
|
using (WebClient wc = new WebClient())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
publicIP = wc.DownloadString("http://ipv4.icanhazip.com").Replace("\\r", "").Replace("\\n", "").Trim();
|
publicIP = wc.DownloadString("http://ipv4.icanhazip.com").Replace("\\r", "").Replace("\\n", "").Trim();
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
WriteLogMessage("Failed to reach public IP endpoint! Using loopback address.", ConsoleColor.Yellow);
|
||||||
|
publicIP = "127.0.0.1";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!File.Exists(CONFIG_PATH))
|
if (!File.Exists(CONFIG_PATH))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue