aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar Vijay Pai <vpai@google.com>2018-12-05 16:04:26 -0800
committerGravatar Vijay Pai <vpai@google.com>2018-12-05 16:04:26 -0800
commiteb0b39df3d9304bf1b15a4c294abaad36a173ddc (patch)
treedf5d656a6831381ef535b61f1ceb83d37f88e5b7 /include
parent9bd5b3778abbb2564544a69d9c99d3c87a3354eb (diff)
Do OnDone as the actual last thing so that the reactor can be reused.
Diffstat (limited to 'include')
-rw-r--r--include/grpcpp/impl/codegen/client_callback.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/grpcpp/impl/codegen/client_callback.h b/include/grpcpp/impl/codegen/client_callback.h
index 4d9579fd6a..ede8ac54ca 100644
--- a/include/grpcpp/impl/codegen/client_callback.h
+++ b/include/grpcpp/impl/codegen/client_callback.h
@@ -255,10 +255,12 @@ class ClientCallbackReaderWriterImpl
void MaybeFinish() {
if (--callbacks_outstanding_ == 0) {
- reactor_->OnDone(finish_status_);
+ Status s = std::move(finish_status_);
+ auto* reactor = reactor_;
auto* call = call_.call();
this->~ClientCallbackReaderWriterImpl();
g_core_codegen_interface->grpc_call_unref(call);
+ reactor->OnDone(s);
}
}
@@ -450,10 +452,12 @@ class ClientCallbackReaderImpl
void MaybeFinish() {
if (--callbacks_outstanding_ == 0) {
- reactor_->OnDone(finish_status_);
+ Status s = std::move(finish_status_);
+ auto* reactor = reactor_;
auto* call = call_.call();
this->~ClientCallbackReaderImpl();
g_core_codegen_interface->grpc_call_unref(call);
+ reactor->OnDone(s);
}
}
@@ -576,10 +580,12 @@ class ClientCallbackWriterImpl
void MaybeFinish() {
if (--callbacks_outstanding_ == 0) {
- reactor_->OnDone(finish_status_);
+ Status s = std::move(finish_status_);
+ auto* reactor = reactor_;
auto* call = call_.call();
this->~ClientCallbackWriterImpl();
g_core_codegen_interface->grpc_call_unref(call);
+ reactor->OnDone(s);
}
}