2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-05-06 11:32:59 +00:00
This commit is contained in:
Ahmed Zamil 2024-12-11 16:31:31 +03:00
parent 979a30805e
commit 7b7723201b

View File

@ -1528,8 +1528,6 @@ partial class DistributedConnection
try try
{ {
rt = ft.MethodInfo.Invoke(target, args); rt = ft.MethodInfo.Invoke(target, args);
if (context != null)
context.Ended = true;
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -1551,9 +1549,16 @@ partial class DistributedConnection
SendReply(actionType, callback) SendReply(actionType, callback)
.AddUInt8((byte)TransmissionTypeIdentifier.Null) .AddUInt8((byte)TransmissionTypeIdentifier.Null)
.Done(); .Done();
if (context != null)
context.Ended = true;
} }
catch (Exception ex) catch (Exception ex)
{ {
if (context != null)
context.Ended = true;
var (code, msg) = SummerizeException(ex); var (code, msg) = SummerizeException(ex);
SendError(ErrorType.Exception, callback, code, msg); SendError(ErrorType.Exception, callback, code, msg);
} }
@ -1563,6 +1568,9 @@ partial class DistributedConnection
{ {
(rt as Task).ContinueWith(t => (rt as Task).ContinueWith(t =>
{ {
if (context != null)
context.Ended = true;
#if NETSTANDARD #if NETSTANDARD
var res = t.GetType().GetTypeInfo().GetProperty("Result").GetValue(t); var res = t.GetType().GetTypeInfo().GetProperty("Result").GetValue(t);
#else #else
@ -1578,6 +1586,9 @@ partial class DistributedConnection
{ {
(rt as AsyncReply).Then(res => (rt as AsyncReply).Then(res =>
{ {
if (context != null)
context.Ended = true;
SendReply(actionType, callback) SendReply(actionType, callback)
.AddUInt8Array(Codec.Compose(res, this)) .AddUInt8Array(Codec.Compose(res, this))
.Done(); .Done();
@ -1595,6 +1606,9 @@ partial class DistributedConnection
} }
else else
{ {
if (context != null)
context.Ended = true;
SendReply(actionType, callback) SendReply(actionType, callback)
.AddUInt8Array(Codec.Compose(rt, this)) .AddUInt8Array(Codec.Compose(rt, this))
.Done(); .Done();