Merge pull request #14858 from jiangtaoli2016/root_cert_once

Init default root certs store once
pull/14869/head
Jiangtao Li 7 years ago committed by GitHub
commit fa7cbb50fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/core/lib/security/security_connector/security_connector.cc
  2. 9
      src/core/lib/security/security_connector/security_connector.h
  3. 1
      src/core/lib/surface/init.cc
  4. 1
      src/core/lib/surface/init.h
  5. 7
      src/core/lib/surface/init_secure.cc
  6. 2
      src/core/lib/surface/init_unsecure.cc

@ -1151,16 +1151,6 @@ const char* DefaultSslRootStore::GetPemRootCerts() {
GRPC_SLICE_START_PTR(default_pem_root_certs_);
}
void DefaultSslRootStore::Initialize() {
default_root_store_ = nullptr;
default_pem_root_certs_ = grpc_empty_slice();
}
void DefaultSslRootStore::Destroy() {
tsi_ssl_root_certs_store_destroy(default_root_store_);
grpc_slice_unref_internal(default_pem_root_certs_);
}
grpc_slice DefaultSslRootStore::ComputePemRootCerts() {
grpc_slice result = grpc_empty_slice();
// First try to load the roots from the environment.

@ -256,15 +256,6 @@ class DefaultSslRootStore {
// Gets the default PEM root certificate.
static const char* GetPemRootCerts();
// Initializes the SSL root store's underlying data structure. It does not
// load default SSL root certificates. Should only be called by
// grpc_security_init().
static void Initialize();
// Destroys the default SSL root store. Should only be called by
// grpc_security_shutdown().
static void Destroy();
protected:
// Returns default PEM root certificates in nullptr terminated grpc_slice.
// This function is protected instead of private, so that it can be tested.

@ -172,7 +172,6 @@ void grpc_shutdown(void) {
}
}
}
grpc_security_shutdown();
grpc_iomgr_shutdown();
gpr_timers_global_destroy();
grpc_tracer_shutdown();

@ -22,7 +22,6 @@
void grpc_register_security_filters(void);
void grpc_security_pre_init(void);
void grpc_security_init(void);
void grpc_security_shutdown(void);
int grpc_is_initialized(void);
#endif /* GRPC_CORE_LIB_SURFACE_INIT_H */

@ -78,9 +78,4 @@ void grpc_register_security_filters(void) {
maybe_prepend_server_auth_filter, nullptr);
}
void grpc_security_init() {
grpc_security_register_handshaker_factories();
grpc_core::DefaultSslRootStore::Initialize();
}
void grpc_security_shutdown() { grpc_core::DefaultSslRootStore::Destroy(); }
void grpc_security_init() { grpc_security_register_handshaker_factories(); }

@ -25,5 +25,3 @@ void grpc_security_pre_init(void) {}
void grpc_register_security_filters(void) {}
void grpc_security_init(void) {}
void grpc_security_shutdown(void) {}

Loading…
Cancel
Save