mirror of
https://github.com/FabInfra/capnproto-dotnetcore_Runtime.git
synced 2025-04-21 02:26:31 +02:00
Troubleshooting / robustness
This commit is contained in:
parent
52fa0ffb5e
commit
3e3b144a80
@ -13,7 +13,6 @@ namespace Capnp.Rpc
|
||||
void RequestPostAction(Action postAction);
|
||||
void Finish(uint questionId);
|
||||
void ReleaseImport(uint importId);
|
||||
void RemoveImport(uint importId);
|
||||
void Resolve(uint preliminaryId, Skeleton preliminaryCap, Func<ConsumedCapability> resolvedCapGetter);
|
||||
|
||||
Task RequestSenderLoopback(Action<MessageTarget.WRITER> writer);
|
||||
|
@ -17,7 +17,6 @@ namespace Capnp.Rpc
|
||||
protected override void ReleaseRemotely()
|
||||
{
|
||||
_ep.ReleaseImport(_remoteId);
|
||||
_ep.RemoveImport(_remoteId);
|
||||
}
|
||||
|
||||
protected override Call.WRITER SetupMessage(DynamicSerializerState args, ulong interfaceId, ushort methodId)
|
||||
|
@ -242,7 +242,7 @@ namespace Capnp.Rpc
|
||||
_ep.ReleaseImport(_remoteId);
|
||||
}
|
||||
|
||||
_ep.RemoveImport(_remoteId);
|
||||
_ep.ReleaseImport(_remoteId);
|
||||
|
||||
this.DisposeWhenResolved();
|
||||
}
|
||||
|
@ -97,5 +97,16 @@ namespace Capnp.Rpc
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void Validate()
|
||||
{
|
||||
lock (_reentrancyBlocker)
|
||||
{
|
||||
if (_refCount <= 0)
|
||||
{
|
||||
throw new ObjectDisposedException(nameof(ConsumedCapability), "Validation failed, capability is already disposed");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1182,6 +1182,7 @@ namespace Capnp.Rpc
|
||||
{
|
||||
if (rcw.Cap.TryGetTarget(out var impCap))
|
||||
{
|
||||
impCap.Validate();
|
||||
rcw.AddRef();
|
||||
return impCap;
|
||||
}
|
||||
@ -1209,6 +1210,7 @@ namespace Capnp.Rpc
|
||||
{
|
||||
if (rcwp.Cap.TryGetTarget(out var impCap))
|
||||
{
|
||||
impCap.Validate();
|
||||
rcwp.AddRef();
|
||||
return impCap;
|
||||
}
|
||||
@ -1281,6 +1283,7 @@ namespace Capnp.Rpc
|
||||
if (rcv.Cap.TryGetTarget(out var impCap))
|
||||
{
|
||||
rcv.AddRef();
|
||||
impCap.Validate();
|
||||
return impCap;
|
||||
}
|
||||
else
|
||||
@ -1430,6 +1433,11 @@ namespace Capnp.Rpc
|
||||
count = rc.RefCount;
|
||||
rc.ReleaseAll();
|
||||
}
|
||||
|
||||
if (exists)
|
||||
{
|
||||
_importTable.Remove(importId);
|
||||
}
|
||||
}
|
||||
|
||||
if (exists && count > 0)
|
||||
@ -1451,17 +1459,6 @@ namespace Capnp.Rpc
|
||||
}
|
||||
}
|
||||
|
||||
void IRpcEndpoint.RemoveImport(uint importId)
|
||||
{
|
||||
lock (_reentrancyBlocker)
|
||||
{
|
||||
if (!_importTable.Remove(importId))
|
||||
{
|
||||
throw new ArgumentException("Given ID does not exist in import table");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Task IRpcEndpoint.RequestSenderLoopback(Action<MessageTarget.WRITER> describe)
|
||||
{
|
||||
(var tcs, uint id) = AllocateDisembargo();
|
||||
|
Loading…
x
Reference in New Issue
Block a user