aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp/client
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-04-27 08:55:08 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-04-27 08:55:50 -0700
commit1fb99552b75e9b3fc1e391bc66049d1091128c5b (patch)
treec16aa91e6db897cc31474844ac3743d7cee892d4 /src/cpp/client
parent7305dc69e69fbd808f932a8b11c433bdcbe8a79d (diff)
Fix early shutdown: await client context deletion before channel deletion
Diffstat (limited to 'src/cpp/client')
-rw-r--r--src/cpp/client/channel.cc2
-rw-r--r--src/cpp/client/channel.h1
2 files changed, 2 insertions, 1 deletions
diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc
index ba8882278f..c541ddfb48 100644
--- a/src/cpp/client/channel.cc
+++ b/src/cpp/client/channel.cc
@@ -71,7 +71,7 @@ Call Channel::CreateCall(const RpcMethod& method, ClientContext* context,
: context->authority().c_str(),
context->raw_deadline());
GRPC_TIMER_MARK(CALL_CREATED, c_call);
- context->set_call(c_call);
+ context->set_call(c_call, shared_from_this());
return Call(c_call, this, cq);
}
diff --git a/src/cpp/client/channel.h b/src/cpp/client/channel.h
index cd239247c8..46009d20ba 100644
--- a/src/cpp/client/channel.h
+++ b/src/cpp/client/channel.h
@@ -51,6 +51,7 @@ class Credentials;
class StreamContextInterface;
class Channel GRPC_FINAL : public GrpcLibrary,
+ public std::enable_shared_from_this<Channel>,
public ChannelInterface {
public:
Channel(const grpc::string& target, grpc_channel* c_channel);