diff --git a/Application/IW4MServer.cs b/Application/IW4MServer.cs index f46ea07f8..edb1a3583 100644 --- a/Application/IW4MServer.cs +++ b/Application/IW4MServer.cs @@ -57,7 +57,6 @@ namespace IW4MAdmin Logger.WriteInfo($"Client {client} connected..."); // Do the player specific stuff - client.ProcessingEvent = clientFromLog.ProcessingEvent; client.ClientNumber = clientFromLog.ClientNumber; client.Score = clientFromLog.Score; client.Ping = clientFromLog.Ping; diff --git a/Plugins/Stats/Helpers/StatManager.cs b/Plugins/Stats/Helpers/StatManager.cs index 695afc5eb..b74fb4647 100644 --- a/Plugins/Stats/Helpers/StatManager.cs +++ b/Plugins/Stats/Helpers/StatManager.cs @@ -1072,7 +1072,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers foreach (var stat in sv.GetClientsAsList() .Select(_client => _client.GetAdditionalProperty(CLIENT_STATS_KEY))) { - stat.StartNewSession(); + stat?.StartNewSession(); } } diff --git a/SharedLibraryCore/PartialEntities/EFClient.cs b/SharedLibraryCore/PartialEntities/EFClient.cs index 6fc04c6a3..0e58cf133 100644 --- a/SharedLibraryCore/PartialEntities/EFClient.cs +++ b/SharedLibraryCore/PartialEntities/EFClient.cs @@ -82,12 +82,12 @@ namespace SharedLibraryCore.Database.Models { "_reportCount", 0 } }; ReceivedPenalties = new List(); - ProcessingEvent = new SemaphoreSlim(1, 1); + _processingEvent = new SemaphoreSlim(1, 1); } ~EFClient() { - ProcessingEvent.Dispose(); + _processingEvent.Dispose(); } public override string ToString() @@ -674,11 +674,11 @@ namespace SharedLibraryCore.Database.Models }; [NotMapped] - public SemaphoreSlim ProcessingEvent; + private readonly SemaphoreSlim _processingEvent; public async Task Lock() { - bool result = await ProcessingEvent.WaitAsync(Utilities.DefaultCommandTimeout); + bool result = await _processingEvent.WaitAsync(Utilities.DefaultCommandTimeout); #if DEBUG if (!result) @@ -690,9 +690,9 @@ namespace SharedLibraryCore.Database.Models public void Unlock() { - if (ProcessingEvent.CurrentCount == 0) + if (_processingEvent.CurrentCount == 0) { - ProcessingEvent.Release(1); + _processingEvent.Release(1); } }