|
|
|
@ -407,12 +407,15 @@ namespace Grpc.Core.Internal |
|
|
|
|
/// <summary> |
|
|
|
|
/// Handler for unary response completion. |
|
|
|
|
/// </summary> |
|
|
|
|
private void HandleUnaryResponse(bool success, ClientSideStatus receivedStatus, byte[] receivedMessage, Metadata responseHeaders) |
|
|
|
|
private void HandleUnaryResponse(bool sucess, ClientSideStatus receivedStatus, byte[] receivedMessage, Metadata responseHeaders) |
|
|
|
|
{ |
|
|
|
|
// NOTE: because this event is a result of batch containing GRPC_OP_RECV_STATUS_ON_CLIENT, |
|
|
|
|
// success will be always set to true. |
|
|
|
|
|
|
|
|
|
using (Profilers.ForCurrentThread().NewScope("AsyncCall.HandleUnaryResponse")) |
|
|
|
|
{ |
|
|
|
|
TResponse msg = default(TResponse); |
|
|
|
|
var deserializeException = success ? TryDeserialize(receivedMessage, out msg) : null; |
|
|
|
|
var deserializeException = TryDeserialize(receivedMessage, out msg); |
|
|
|
|
|
|
|
|
|
lock (myLock) |
|
|
|
|
{ |
|
|
|
@ -425,14 +428,13 @@ namespace Grpc.Core.Internal |
|
|
|
|
finishedStatus = receivedStatus; |
|
|
|
|
|
|
|
|
|
ReleaseResourcesIfPossible(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
responseHeadersTcs.SetResult(responseHeaders); |
|
|
|
|
|
|
|
|
|
var status = receivedStatus.Status; |
|
|
|
|
|
|
|
|
|
if (!success || status.StatusCode != StatusCode.OK) |
|
|
|
|
if (status.StatusCode != StatusCode.OK) |
|
|
|
|
{ |
|
|
|
|
unaryResponseTcs.SetException(new RpcException(status)); |
|
|
|
|
return; |
|
|
|
@ -447,6 +449,9 @@ namespace Grpc.Core.Internal |
|
|
|
|
/// </summary> |
|
|
|
|
private void HandleFinished(bool success, ClientSideStatus receivedStatus) |
|
|
|
|
{ |
|
|
|
|
// NOTE: because this event is a result of batch containing GRPC_OP_RECV_STATUS_ON_CLIENT, |
|
|
|
|
// success will be always set to true. |
|
|
|
|
|
|
|
|
|
lock (myLock) |
|
|
|
|
{ |
|
|
|
|
finished = true; |
|
|
|
@ -457,7 +462,7 @@ namespace Grpc.Core.Internal |
|
|
|
|
|
|
|
|
|
var status = receivedStatus.Status; |
|
|
|
|
|
|
|
|
|
if (!success || status.StatusCode != StatusCode.OK) |
|
|
|
|
if (status.StatusCode != StatusCode.OK) |
|
|
|
|
{ |
|
|
|
|
streamingCallFinishedTcs.SetException(new RpcException(status)); |
|
|
|
|
return; |
|
|
|
|