mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2025-05-06 11:32:59 +00:00
Merge branch 'main' of https://github.com/esiur/esiur-dotnet
This commit is contained in:
commit
5f874bc112
@ -5,7 +5,7 @@
|
|||||||
<Copyright>Ahmed Kh. Zamil</Copyright>
|
<Copyright>Ahmed Kh. Zamil</Copyright>
|
||||||
<PackageProjectUrl>http://www.esiur.com</PackageProjectUrl>
|
<PackageProjectUrl>http://www.esiur.com</PackageProjectUrl>
|
||||||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
|
||||||
<Version>2.4.3</Version>
|
<Version>2.4.4</Version>
|
||||||
<RepositoryUrl>https://github.com/esiur/esiur-dotnet</RepositoryUrl>
|
<RepositoryUrl>https://github.com/esiur/esiur-dotnet</RepositoryUrl>
|
||||||
<Authors>Ahmed Kh. Zamil</Authors>
|
<Authors>Ahmed Kh. Zamil</Authors>
|
||||||
<AssemblyVersion></AssemblyVersion>
|
<AssemblyVersion></AssemblyVersion>
|
||||||
|
@ -1817,7 +1817,7 @@ public partial class DistributedConnection : NetworkConnection, IStore
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
x.TriggerError(new AsyncException(ErrorType.Management, 0, "Connection closed"));
|
x.Reply.TriggerError(new AsyncException(ErrorType.Management, 0, "Connection closed"));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -48,7 +48,7 @@ partial class DistributedConnection
|
|||||||
KeyList<uint, WeakReference<DistributedResource>> attachedResources = new KeyList<uint, WeakReference<DistributedResource>>();
|
KeyList<uint, WeakReference<DistributedResource>> attachedResources = new KeyList<uint, WeakReference<DistributedResource>>();
|
||||||
KeyList<uint, WeakReference<DistributedResource>> suspendedResources = new KeyList<uint, WeakReference<DistributedResource>>();
|
KeyList<uint, WeakReference<DistributedResource>> suspendedResources = new KeyList<uint, WeakReference<DistributedResource>>();
|
||||||
|
|
||||||
KeyList<uint, AsyncReply<DistributedResource>> resourceRequests = new KeyList<uint, AsyncReply<DistributedResource>>();
|
KeyList<uint, DistributedResourceAttachRequestInfo> resourceRequests = new KeyList<uint, DistributedResourceAttachRequestInfo>();
|
||||||
KeyList<Guid, AsyncReply<TypeTemplate>> templateRequests = new KeyList<Guid, AsyncReply<TypeTemplate>>();
|
KeyList<Guid, AsyncReply<TypeTemplate>> templateRequests = new KeyList<Guid, AsyncReply<TypeTemplate>>();
|
||||||
|
|
||||||
KeyList<string, AsyncReply<TypeTemplate>> templateByNameRequests = new KeyList<string, AsyncReply<TypeTemplate>>();
|
KeyList<string, AsyncReply<TypeTemplate>> templateByNameRequests = new KeyList<string, AsyncReply<TypeTemplate>>();
|
||||||
@ -2249,14 +2249,24 @@ partial class DistributedConnection
|
|||||||
|
|
||||||
resource = neededResources[id];
|
resource = neededResources[id];
|
||||||
|
|
||||||
var request = resourceRequests[id];
|
var requestInfo = resourceRequests[id];
|
||||||
|
|
||||||
if (request != null)
|
if (requestInfo != null)
|
||||||
{
|
{
|
||||||
if (resource != null && (requestSequence?.Contains(id) ?? false))
|
if (resource != null && (requestSequence?.Contains(id) ?? false))
|
||||||
|
{
|
||||||
|
// dead lock avoidance for loop reference.
|
||||||
return new AsyncReply<DistributedResource>(resource);
|
return new AsyncReply<DistributedResource>(resource);
|
||||||
|
}
|
||||||
|
else if (resource != null && requestInfo.RequestSequence.Contains(id))
|
||||||
|
{
|
||||||
|
// dead lock avoidance for dependent reference.
|
||||||
|
return new AsyncReply<DistributedResource>(resource);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return request;
|
{
|
||||||
|
return requestInfo.Reply;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (resource != null && !resource.DistributedResourceSuspended)
|
else if (resource != null && !resource.DistributedResourceSuspended)
|
||||||
{
|
{
|
||||||
@ -2266,11 +2276,10 @@ partial class DistributedConnection
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var newSequence = requestSequence != null ? requestSequence.Concat(new uint[] { id }).ToArray() : new uint[] { id };
|
||||||
|
|
||||||
var reply = new AsyncReply<DistributedResource>();
|
var reply = new AsyncReply<DistributedResource>();
|
||||||
resourceRequests.Add(id, reply);
|
resourceRequests.Add(id, new DistributedResourceAttachRequestInfo(reply, newSequence));
|
||||||
|
|
||||||
var newSequence = requestSequence != null ? requestSequence.Concat(new uint[] { id }).ToArray() : new uint[] { id };
|
|
||||||
|
|
||||||
SendRequest(IIPPacketAction.AttachResource)
|
SendRequest(IIPPacketAction.AttachResource)
|
||||||
.AddUInt32(id)
|
.AddUInt32(id)
|
||||||
|
20
Esiur/Net/IIP/DistributedResourceAttachRequestInfo.cs
Normal file
20
Esiur/Net/IIP/DistributedResourceAttachRequestInfo.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using Esiur.Core;
|
||||||
|
using Esiur.Resource;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Esiur.Net.IIP
|
||||||
|
{
|
||||||
|
internal class DistributedResourceAttachRequestInfo
|
||||||
|
{
|
||||||
|
public AsyncReply<DistributedResource> Reply { get; set; }
|
||||||
|
public uint[] RequestSequence { get; set; }
|
||||||
|
|
||||||
|
public DistributedResourceAttachRequestInfo(AsyncReply<DistributedResource> reply, uint[] requestSequence)
|
||||||
|
{
|
||||||
|
Reply = reply;
|
||||||
|
RequestSequence = requestSequence;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user