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 long CCU;
|
||||
public long totalServerCount;
|
||||
public List<KeyValuePair<RelayAddress, RelayServerInfo>> connectedNodes;
|
||||
}
|
||||
|
||||
// container for relay address info
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace LightReflectiveMirror.LoadBalancing
|
||||
{
|
||||
public partial class Endpoint
|
||||
|
|
@ -22,6 +24,7 @@ namespace LightReflectiveMirror.LoadBalancing
|
|||
uptime = DateTime.Now - Program.startupTime,
|
||||
CCU = Program.instance.GetTotalCCU(),
|
||||
totalServerCount = Program.instance.GetTotalServers(),
|
||||
connectedNodes = Program.instance.availableRelayServers.ToList()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,16 @@ namespace LightReflectiveMirror
|
|||
instance = this;
|
||||
_startupTime = DateTime.Now;
|
||||
using (WebClient wc = new WebClient())
|
||||
{
|
||||
try
|
||||
{
|
||||
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))
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue