Merge pull request #17154 from liutongxuan/master

g_default_client_callbacks shouldn't be global variable
pull/17265/head
Yang Gao 6 years ago committed by GitHub
commit e4e564679b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      src/cpp/client/client_context.cc

@ -41,9 +41,10 @@ class DefaultGlobalClientCallbacks final
};
static internal::GrpcLibraryInitializer g_gli_initializer;
static DefaultGlobalClientCallbacks g_default_client_callbacks;
static DefaultGlobalClientCallbacks* g_default_client_callbacks =
new DefaultGlobalClientCallbacks();
static ClientContext::GlobalCallbacks* g_client_callbacks =
&g_default_client_callbacks;
g_default_client_callbacks;
ClientContext::ClientContext()
: initial_metadata_received_(false),
@ -139,9 +140,9 @@ grpc::string ClientContext::peer() const {
}
void ClientContext::SetGlobalCallbacks(GlobalCallbacks* client_callbacks) {
GPR_ASSERT(g_client_callbacks == &g_default_client_callbacks);
GPR_ASSERT(g_client_callbacks == g_default_client_callbacks);
GPR_ASSERT(client_callbacks != nullptr);
GPR_ASSERT(client_callbacks != &g_default_client_callbacks);
GPR_ASSERT(client_callbacks != g_default_client_callbacks);
g_client_callbacks = client_callbacks;
}

Loading…
Cancel
Save