remove waiting semaphore for marking offline when disposing
This commit is contained in:
@@ -192,11 +192,12 @@ public class Pair
|
|||||||
return UserPair != null || GroupPair.Any();
|
return UserPair != null || GroupPair.Any();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MarkOffline()
|
public void MarkOffline(bool wait = true)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_creationSemaphore.Wait();
|
if (wait)
|
||||||
|
_creationSemaphore.Wait();
|
||||||
_onlineUserIdentDto = null;
|
_onlineUserIdentDto = null;
|
||||||
LastReceivedCharacterData = null;
|
LastReceivedCharacterData = null;
|
||||||
var player = CachedPlayer;
|
var player = CachedPlayer;
|
||||||
@@ -205,7 +206,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();
|
||||||
|
|||||||
Reference in New Issue
Block a user