Merge pull request #16950 from vjpai/membug2

Fix CallOpSet copy/assignment to reset cq_tag
reviewable/pr16773/r4
Vijay Pai 6 years ago committed by GitHub
commit 340bffa555
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      include/grpcpp/impl/codegen/call.h
  2. 4
      src/cpp/server/server_cc.cc

@ -624,6 +624,19 @@ class CallOpSet : public CallOpSetInterface,
public Op6 { public Op6 {
public: public:
CallOpSet() : cq_tag_(this), return_tag_(this), call_(nullptr) {} CallOpSet() : cq_tag_(this), return_tag_(this), call_(nullptr) {}
// The copy constructor and assignment operator reset the value of
// cq_tag_ and return_tag_ since those are only meaningful on a specific
// object, not across objects.
CallOpSet(const CallOpSet& other)
: cq_tag_(this), return_tag_(this), call_(other.call_) {}
CallOpSet& operator=(const CallOpSet& other) {
cq_tag_ = this;
return_tag_ = this;
call_ = other.call_;
return *this;
}
void FillOps(grpc_call* call, grpc_op* ops, size_t* nops) override { void FillOps(grpc_call* call, grpc_op* ops, size_t* nops) override {
this->Op1::AddOp(ops, nops); this->Op1::AddOp(ops, nops);
this->Op2::AddOp(ops, nops); this->Op2::AddOp(ops, nops);

@ -685,8 +685,8 @@ void Server::PerformOpsOnCall(internal::CallOpSetInterface* ops,
size_t nops = 0; size_t nops = 0;
grpc_op cops[MAX_OPS]; grpc_op cops[MAX_OPS];
ops->FillOps(call->call(), cops, &nops); ops->FillOps(call->call(), cops, &nops);
// TODO(vjpai): Use ops->cq_tag once this case supports callbacks auto result =
auto result = grpc_call_start_batch(call->call(), cops, nops, ops, nullptr); grpc_call_start_batch(call->call(), cops, nops, ops->cq_tag(), nullptr);
if (result != GRPC_CALL_OK) { if (result != GRPC_CALL_OK) {
gpr_log(GPR_ERROR, "Fatal: grpc_call_start_batch returned %d", result); gpr_log(GPR_ERROR, "Fatal: grpc_call_start_batch returned %d", result);
grpc_call_log_batch(__FILE__, __LINE__, GPR_LOG_SEVERITY_ERROR, grpc_call_log_batch(__FILE__, __LINE__, GPR_LOG_SEVERITY_ERROR,

Loading…
Cancel
Save