(potentially) fixed object disposed issue with semaphore
fix random issue where we were trying to reset a session for a player that has not fully connected
This commit is contained in:
parent
c9e6ce0bca
commit
042fde971e
@ -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;
|
||||
|
@ -1072,7 +1072,7 @@ namespace IW4MAdmin.Plugins.Stats.Helpers
|
||||
foreach (var stat in sv.GetClientsAsList()
|
||||
.Select(_client => _client.GetAdditionalProperty<EFClientStatistics>(CLIENT_STATS_KEY)))
|
||||
{
|
||||
stat.StartNewSession();
|
||||
stat?.StartNewSession();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,12 +82,12 @@ namespace SharedLibraryCore.Database.Models
|
||||
{ "_reportCount", 0 }
|
||||
};
|
||||
ReceivedPenalties = new List<EFPenalty>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user