mirror of
https://github.com/Caraxi/mare.client.git
synced 2025-12-12 21:17:22 +01:00
remove waiting semaphore for marking offline when disposing
This commit is contained in:
parent
860e074d53
commit
d732e0439f
2 changed files with 6 additions and 4 deletions
|
|
@ -185,11 +185,12 @@ public class Pair
|
||||||
return UserPair.Groups.Any() || UserPair.IndividualPairStatus != IndividualPairStatus.None;
|
return UserPair.Groups.Any() || UserPair.IndividualPairStatus != IndividualPairStatus.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MarkOffline()
|
public void MarkOffline(bool wait = true)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_creationSemaphore.Wait();
|
if (wait)
|
||||||
|
_creationSemaphore.Wait();
|
||||||
LastReceivedCharacterData = null;
|
LastReceivedCharacterData = null;
|
||||||
var player = CachedPlayer;
|
var player = CachedPlayer;
|
||||||
CachedPlayer = null;
|
CachedPlayer = null;
|
||||||
|
|
@ -198,7 +199,8 @@ public class Pair
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_creationSemaphore.Release();
|
if (wait)
|
||||||
|
_creationSemaphore.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -356,7 +356,7 @@ public sealed class PairManager : DisposableMediatorSubscriberBase
|
||||||
Logger.LogDebug("Disposing all Pairs");
|
Logger.LogDebug("Disposing all Pairs");
|
||||||
Parallel.ForEach(_allClientPairs, item =>
|
Parallel.ForEach(_allClientPairs, item =>
|
||||||
{
|
{
|
||||||
item.Value.MarkOffline();
|
item.Value.MarkOffline(wait: false);
|
||||||
});
|
});
|
||||||
|
|
||||||
RecreateLazy();
|
RecreateLazy();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue