Update time server list

This commit is contained in:
Carsten Larsen 2016-12-17 11:16:22 +01:00
parent 8a25675916
commit 1e6febc0f9
2 changed files with 1395 additions and 1517 deletions

File diff suppressed because it is too large Load Diff

View File

@ -29,6 +29,7 @@
using Ntp.Analyzer.Config;
using Ntp.Analyzer.Config.Node;
using Ntp.Analyzer.Data;
using Ntp.Analyzer.Data.Import;
using Ntp.Analyzer.Export;
using Ntp.Analyzer.Import;
using Ntp.Analyzer.Monitor.Client;
@ -195,8 +196,6 @@ private void InitializeData()
if (!config.Database.Initialize)
return;
var knownServers = TimeServers.List.ToDictionary(i => i.Value, i => i.Key);
try
{
// Initialize hosts
@ -216,14 +215,14 @@ private void InitializeData()
}
int? orgId = null;
if (knownServers.ContainsKey(server.ServerName))
if (TimeServers.List.ContainsKey(server.ServerName))
{
orgId = knownServers[server.ServerName];
orgId = TimeServers.List[server.ServerName];
Log.KnownServer(orgId.Value, server.ServerName);
}
else if (!Equals(ip, IPAddress.None) && knownServers.ContainsKey(ip.ToString()))
else if (!Equals(ip, IPAddress.None) && TimeServers.List.ContainsKey(ip.ToString()))
{
orgId = knownServers[ip.ToString()];
orgId = TimeServers.List[ip.ToString()];
Log.KnownServer(orgId.Value, ip.ToString());
}
@ -231,15 +230,15 @@ private void InitializeData()
DataFace.Instance.Hosts.Save(host);
Log.NewHost(server, ip);
}
else if (host.OrgId == null && knownServers.ContainsKey(host.Ip))
else if (host.OrgId == null && TimeServers.List.ContainsKey(host.Ip))
{
host.OrgId = knownServers[host.Ip];
host.OrgId = TimeServers.List[host.Ip];
Log.KnownServer(host.OrgId.Value, host.Ip);
DataFace.Instance.Hosts.Save(host);
}
else if (host.OrgId == null && knownServers.ContainsKey(host.Name))
else if (host.OrgId == null && TimeServers.List.ContainsKey(host.Name))
{
host.OrgId = knownServers[host.Name];
host.OrgId = TimeServers.List[host.Name];
Log.KnownServer(host.OrgId.Value, host.Name);
DataFace.Instance.Hosts.Save(host);
}
@ -258,9 +257,9 @@ private void InitializeData()
continue;
TimeServer timeServer = null;
if (knownServers.ContainsKey(entry.Remote))
if (TimeServers.List.ContainsKey(entry.Remote))
{
int orgId = knownServers[entry.Remote];
int orgId = TimeServers.List[entry.Remote];
timeServer = DataFace.Instance.Servers[orgId];
Log.KnownServer(orgId, entry.Remote);
}