2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-06-27 13:33:13 +00:00

AutoReconnect

This commit is contained in:
2022-08-11 21:28:16 +03:00
parent af94ce318a
commit 21a2061fc4
12 changed files with 355 additions and 154 deletions

View File

@ -873,7 +873,7 @@ public static class Warehouse
resources.TryRemove(resource.Instance.Id, out resourceReference);
else
return false;
//}
if (resource != resource.Instance.Store)
{
@ -884,30 +884,16 @@ public static class Warehouse
lock (((ICollection)list).SyncRoot)
list.Remove(resourceReference);
//list.TryTake(resourceReference);
}//.Remove(resourceReference);
}
}
if (resource is IStore)
{
var store = resource as IStore;
List<WeakReference<IResource>> toBeRemoved;// = stores[store];
List<WeakReference<IResource>> toBeRemoved;
stores.TryRemove(store, out toBeRemoved);
//lock (resourcesLock)
//{
// // remove all objects associated with the store
// toBeRemoved = resources.Values.Where(x =>
// {
// IResource r;
// if (x.TryGetTarget(out r))
// return r.Instance.Store == resource;
// else
// return false;
// }).ToArray();
//}
foreach (var o in toBeRemoved)
{