aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/grpc++/client_context.h3
-rw-r--r--src/cpp/client/client_context.cc2
2 files changed, 4 insertions, 1 deletions
diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h
index d3f23fe047..8e7c3579e3 100644
--- a/include/grpc++/client_context.h
+++ b/include/grpc++/client_context.h
@@ -283,10 +283,11 @@ class ClientContext {
/// Global Callbacks
///
/// Can be set exactly once per application to install hooks whenever
- /// a client context is constructed.
+ /// a client context is constructed and destructed.
class GlobalCallbacks {
public:
virtual void DefaultConstructor(ClientContext* context) = 0;
+ virtual void Destructor(ClientContext* context) = 0;
};
static void SetGlobalCallbacks(GlobalCallbacks* callbacks);
diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc
index f33c1e3a9f..a4fdfcb0de 100644
--- a/src/cpp/client/client_context.cc
+++ b/src/cpp/client/client_context.cc
@@ -48,6 +48,7 @@ namespace grpc {
class DefaultGlobalCallbacks GRPC_FINAL : public ClientContext::GlobalCallbacks {
public:
void DefaultConstructor(ClientContext* context) GRPC_OVERRIDE {}
+ void Destructor(ClientContext* context) GRPC_OVERRIDE {}
};
static DefaultGlobalCallbacks g_default_callbacks;
@@ -66,6 +67,7 @@ ClientContext::~ClientContext() {
if (call_) {
grpc_call_destroy(call_);
}
+ g_callbacks->Destructor(this);
}
std::unique_ptr<ClientContext> ClientContext::FromServerContext(