aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2018-11-21 14:11:59 -0800
committerGravatar Yash Tibrewal <yashkt@google.com>2018-11-21 14:11:59 -0800
commit8fb11e6d5e2228523f79c3ed8ee1b4d8fb4b7174 (patch)
tree5b14b32fb240f63e6d799856c91371eedc3c690e /include
parent544f2a5abbee840c5b7a28b41e75b3ff5c0f3b60 (diff)
Apply the conversion on the status irrespective of whether Pluck returned true
Diffstat (limited to 'include')
-rw-r--r--include/grpcpp/impl/codegen/client_unary_call.h23
1 files changed, 11 insertions, 12 deletions
diff --git a/include/grpcpp/impl/codegen/client_unary_call.h b/include/grpcpp/impl/codegen/client_unary_call.h
index 18ee5b34bf..5151839412 100644
--- a/include/grpcpp/impl/codegen/client_unary_call.h
+++ b/include/grpcpp/impl/codegen/client_unary_call.h
@@ -69,18 +69,17 @@ class BlockingUnaryCallImpl {
ops.ClientSendClose();
ops.ClientRecvStatus(context, &status_);
call.PerformOps(&ops);
- if (cq.Pluck(&ops)) {
- if (!ops.got_message && status_.ok()) {
- status_ = Status(StatusCode::UNIMPLEMENTED,
- "No message returned for unary request");
- }
- } else {
- // Some of the ops failed. For example, this can happen if deserialization
- // of the message fails. gRPC Core guarantees that the op
- // GRPC_OP_RECV_STATUS_ON_CLIENT always succeeds, so status would still be
- // filled.
- // TODO(yashykt): If deserialization fails, but the status received is OK,
- // then it might be a good idea to change the status to reflect this.
+ cq.Pluck(&ops);
+ // Some of the ops might fail. If the ops fail in the core layer, status
+ // would reflect the error. But, if the ops fail in the C++ layer, the
+ // status would still be the same as the one returned by gRPC Core. This can
+ // happen if deserialization of the message fails.
+ // TODO(yashykt): If deserialization fails, but the status received is OK,
+ // then it might be a good idea to change the status to something better
+ // than StatusCode::UNIMPLEMENTED to reflect this.
+ if (!ops.got_message && status_.ok()) {
+ status_ = Status(StatusCode::UNIMPLEMENTED,
+ "No message returned for unary request");
}
}
Status status() { return status_; }