mirror of
https://bitbucket.org/anguist/ntpa
synced 2026-10-06 03:39:49 +00:00
Improved thread safety
This commit is contained in:
@@ -33,13 +33,13 @@ using Ntp.Analyzer.Objects.Live;
|
||||
|
||||
namespace Ntp.Analyzer.Statistics
|
||||
{
|
||||
public class SummeryBuilder
|
||||
public class StatusBuilder
|
||||
{
|
||||
private readonly FileInfo configuration;
|
||||
private readonly List<StatusLine> entries = new List<StatusLine>();
|
||||
private readonly ServerName server;
|
||||
|
||||
public SummeryBuilder(ServerName server, FileInfo configuration)
|
||||
public StatusBuilder(ServerName server, FileInfo configuration)
|
||||
{
|
||||
this.server = server;
|
||||
this.configuration = configuration;
|
||||
@@ -52,7 +52,9 @@ namespace Ntp.Analyzer.Statistics
|
||||
|
||||
public void Build()
|
||||
{
|
||||
foreach (NtpConfEntry entry in DataFace.Instance.NtpConfigCache[configuration.FullName])
|
||||
IEnumerable<NtpConfEntry> config = DataFace.Instance.NtpConfigCache [configuration.FullName];
|
||||
|
||||
foreach (NtpConfEntry entry in config)
|
||||
{
|
||||
AssociationEntry peerStatus = DataFace.Instance.NtpqCache[server.Name].
|
||||
SingleOrDefault(p => p.Remote == entry.Address.ToString());
|
||||
|
||||
@@ -33,13 +33,13 @@ using Ntp.Analyzer.Objects.Live;
|
||||
|
||||
namespace Ntp.Analyzer.Statistics
|
||||
{
|
||||
public class StatusBuilder
|
||||
public class SummeryBuilder
|
||||
{
|
||||
private readonly FileInfo configuration;
|
||||
private readonly List<StatusLine> entries = new List<StatusLine>();
|
||||
private readonly ServerName server;
|
||||
|
||||
public StatusBuilder(ServerName server, FileInfo configuration)
|
||||
public SummeryBuilder(ServerName server, FileInfo configuration)
|
||||
{
|
||||
this.server = server;
|
||||
this.configuration = configuration;
|
||||
@@ -52,9 +52,7 @@ namespace Ntp.Analyzer.Statistics
|
||||
|
||||
public void Build()
|
||||
{
|
||||
IEnumerable<NtpConfEntry> config = DataFace.Instance.NtpConfigCache [configuration.FullName];
|
||||
|
||||
foreach (NtpConfEntry entry in config)
|
||||
foreach (NtpConfEntry entry in DataFace.Instance.NtpConfigCache[configuration.FullName])
|
||||
{
|
||||
AssociationEntry peerStatus = DataFace.Instance.NtpqCache[server.Name].
|
||||
SingleOrDefault(p => p.Remote == entry.Address.ToString());
|
||||
|
||||
Reference in New Issue
Block a user