diff options
author | Craig Tiller <ctiller@google.com> | 2017-01-12 14:27:01 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-01-12 14:27:01 -0800 |
commit | 81eceb31ccab4a91e84ef06833d43d8c9e49de0f (patch) | |
tree | 3ad86e985578debfea72647db18f1589e3e935ca /include/grpc++ | |
parent | 9d4fc31da4e86358ad02aa24ab86ed1ca82b9ee9 (diff) |
Remove bogus assert
Diffstat (limited to 'include/grpc++')
-rw-r--r-- | include/grpc++/impl/codegen/client_unary_call.h | 9 | ||||
-rw-r--r-- | include/grpc++/impl/codegen/core_codegen.h | 3 | ||||
-rw-r--r-- | include/grpc++/impl/codegen/core_codegen_interface.h | 13 |
3 files changed, 17 insertions, 8 deletions
diff --git a/include/grpc++/impl/codegen/client_unary_call.h b/include/grpc++/impl/codegen/client_unary_call.h index 70d65549c8..201e52ae07 100644 --- a/include/grpc++/impl/codegen/client_unary_call.h +++ b/include/grpc++/impl/codegen/client_unary_call.h @@ -69,7 +69,14 @@ Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method, ops.ClientSendClose(); ops.ClientRecvStatus(context, &status); call.PerformOps(&ops); - GPR_CODEGEN_ASSERT((cq.Pluck(&ops) && ops.got_message) || !status.ok()); + if (cq.Pluck(&ops)) { + if (!ops.got_message && status.ok()) { + return Status(StatusCode::UNIMPLEMENTED, + "No message returned for unary request"); + } + } else { + GPR_CODEGEN_ASSERT(!status.ok()); + } return status; } diff --git a/include/grpc++/impl/codegen/core_codegen.h b/include/grpc++/impl/codegen/core_codegen.h index b5ab26154e..754bf14b25 100644 --- a/include/grpc++/impl/codegen/core_codegen.h +++ b/include/grpc++/impl/codegen/core_codegen.h @@ -94,7 +94,8 @@ class CoreCodegen : public CoreCodegenInterface { virtual const Status& ok() override; virtual const Status& cancelled() override; - void assert_fail(const char* failed_assertion) override; + void assert_fail(const char* failed_assertion, const char* file, + int line) override; }; } // namespace grpc diff --git a/include/grpc++/impl/codegen/core_codegen_interface.h b/include/grpc++/impl/codegen/core_codegen_interface.h index 9c1af972b3..45ea040303 100644 --- a/include/grpc++/impl/codegen/core_codegen_interface.h +++ b/include/grpc++/impl/codegen/core_codegen_interface.h @@ -56,7 +56,8 @@ namespace grpc { class CoreCodegenInterface { public: /// Upon a failed assertion, log the error. - virtual void assert_fail(const char* failed_assertion) = 0; + virtual void assert_fail(const char* failed_assertion, const char* file, + int line) = 0; virtual grpc_completion_queue* grpc_completion_queue_create( void* reserved) = 0; @@ -117,11 +118,11 @@ class CoreCodegenInterface { extern CoreCodegenInterface* g_core_codegen_interface; /// Codegen specific version of \a GPR_ASSERT. -#define GPR_CODEGEN_ASSERT(x) \ - do { \ - if (!(x)) { \ - grpc::g_core_codegen_interface->assert_fail(#x); \ - } \ +#define GPR_CODEGEN_ASSERT(x) \ + do { \ + if (!(x)) { \ + grpc::g_core_codegen_interface->assert_fail(#x, __FILE__, __LINE__); \ + } \ } while (0) } // namespace grpc |