MCPcopy Create free account
hub / github.com/apache/brpc / RemoveCertificate

Method RemoveCertificate

src/brpc/server.cpp:2070–2095  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2068}
2069
2070int Server::RemoveCertificate(const CertInfo& cert) {
2071 if (!_options.has_ssl_options()) {
2072 LOG(ERROR) << "ServerOptions.ssl_options is not configured yet";
2073 return -1;
2074 }
2075 std::string cert_key(cert.certificate);
2076 cert_key.append(cert.private_key);
2077 SSLContext* ssl_ctx = _ssl_ctx_map.seek(cert_key);
2078 if (ssl_ctx == NULL) {
2079 LOG(WARNING) << cert << " doesn't exist";
2080 return 0;
2081 }
2082 if (ssl_ctx->ctx == _default_ssl_ctx) {
2083 LOG(WARNING) << "Cannot remove: " << cert
2084 << " since it's the default certificate";
2085 return -1;
2086 }
2087
2088 if (!_reload_cert_maps.Modify(RemoveCertMapping, *ssl_ctx)) {
2089 LOG(ERROR) << "Fail to remove mappings from _reload_cert_maps";
2090 return -1;
2091 }
2092
2093 _ssl_ctx_map.erase(cert_key);
2094 return 0;
2095}
2096
2097bool Server::RemoveCertMapping(CertMaps& bg, const SSLContext& ssl_ctx) {
2098 for (size_t i = 0; i < ssl_ctx.filters.size(); ++i) {

Callers 1

TEST_FFunction · 0.80

Calls 5

ModifyMethod · 0.80
has_ssl_optionsMethod · 0.45
appendMethod · 0.45
seekMethod · 0.45
eraseMethod · 0.45

Tested by 1

TEST_FFunction · 0.64