diff options
author | 2015-05-04 22:12:39 -0700 | |
---|---|---|
committer | 2015-05-04 22:12:39 -0700 | |
commit | 8e7fe9b9f01f88e322b97bdd5ed399395e563cde (patch) | |
tree | da54d2cbb3d3b4d42f75a668aac90df95c19993b /src/csharp/Grpc.Core/Internal/AsyncCallBase.cs | |
parent | 85b5e8b63b77f40026092feb7d388a7e2c5cfd87 (diff) | |
parent | 1215c33c43fabc2730a2b8cd2d86c414b6fb11da (diff) |
Merge pull request #5 from jtattermusch/bye-bye-completion-queue-pie
C# fixes for #1472 core API cleanup
Diffstat (limited to 'src/csharp/Grpc.Core/Internal/AsyncCallBase.cs')
-rw-r--r-- | src/csharp/Grpc.Core/Internal/AsyncCallBase.cs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs index 15b0cfe249..eb7b8b1ffc 100644 --- a/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs +++ b/src/csharp/Grpc.Core/Internal/AsyncCallBase.cs @@ -302,13 +302,12 @@ namespace Grpc.Core.Internal /// </summary> protected CompletionCallbackDelegate CreateBatchCompletionCallback(Action<bool, BatchContextSafeHandleNotOwned> handler) { - return new CompletionCallbackDelegate((error, batchContextPtr) => + return new CompletionCallbackDelegate((success, batchContextPtr) => { try { var ctx = new BatchContextSafeHandleNotOwned(batchContextPtr); - bool wasError = (error != GRPCOpError.GRPC_OP_OK); - handler(wasError, ctx); + handler(success, ctx); } catch (Exception e) { @@ -320,7 +319,7 @@ namespace Grpc.Core.Internal /// <summary> /// Handles send completion. /// </summary> - private void HandleSendFinished(bool wasError, BatchContextSafeHandleNotOwned ctx) + private void HandleSendFinished(bool success, BatchContextSafeHandleNotOwned ctx) { AsyncCompletionDelegate origCompletionDelegate = null; lock (myLock) @@ -331,7 +330,7 @@ namespace Grpc.Core.Internal ReleaseResourcesIfPossible(); } - if (wasError) + if (!success) { FireCompletion(origCompletionDelegate, new OperationFailedException("Send failed")); } @@ -344,7 +343,7 @@ namespace Grpc.Core.Internal /// <summary> /// Handles halfclose completion. /// </summary> - private void HandleHalfclosed(bool wasError, BatchContextSafeHandleNotOwned ctx) + private void HandleHalfclosed(bool success, BatchContextSafeHandleNotOwned ctx) { AsyncCompletionDelegate origCompletionDelegate = null; lock (myLock) @@ -356,7 +355,7 @@ namespace Grpc.Core.Internal ReleaseResourcesIfPossible(); } - if (wasError) + if (!success) { FireCompletion(origCompletionDelegate, new OperationFailedException("Halfclose failed")); } @@ -369,7 +368,7 @@ namespace Grpc.Core.Internal /// <summary> /// Handles streaming read completion. /// </summary> - private void HandleReadFinished(bool wasError, BatchContextSafeHandleNotOwned ctx) + private void HandleReadFinished(bool success, BatchContextSafeHandleNotOwned ctx) { var payload = ctx.GetReceivedMessage(); |