Skip to content

Commit 13949b8

Browse files
author
liguoliang
committed
优化代码
1 parent da483d0 commit 13949b8

2 files changed

Lines changed: 2 additions & 7 deletions

File tree

src/DotNetCoreRpc.Client/RequestHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private async Task<T> TaskResultHandle<T>(MethodInfo methodInfo, params object[]
7575
}
7676

7777
TypeInfo methodReturnType = methodInfo.ReturnType.GetTypeInfo();
78-
if (methodReturnType.IsAsync() && !methodReturnType.IsTask() && !methodReturnType.IsValueTask())
78+
if (methodReturnType.IsAsync() && (methodReturnType.IsTaskWithResult() || methodReturnType.IsValueTaskWithResult()))
7979
{
8080
methodReturnType = methodReturnType.GetGenericArguments()[0].GetTypeInfo();
8181
}

src/DotNetCoreRpc.Server/DotNetCoreRpcMiddleware.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,7 @@ private static RpcRequestDelegate PiplineEndPoint(object instance, RpcContext as
140140
var returnValueType = returnValue.GetType().GetTypeInfo();
141141
if (returnValueType.IsAsync())
142142
{
143-
if (returnValueType.IsTask() || returnValueType.IsValueTask())
144-
{
145-
return;
146-
}
147-
148-
if (returnValueType.IsTaskWithVoidTaskResult())
143+
if (returnValueType.IsTask() || returnValueType.IsValueTask() || returnValueType.IsTaskWithVoidTaskResult())
149144
{
150145
return;
151146
}

0 commit comments

Comments
 (0)