MCPcopy Create free account
hub / github.com/apache/trafficserver / getOrLoadSecret

Method getOrLoadSecret

src/iocore/net/SSLSecret.cc:145–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145void
146SSLSecret::getOrLoadSecret(const std::string &name1, const std::string &name2, std::string &data1, std::string &data2)
147{
148 Dbg(dbg_ctl_ssl_secret, "lookup up secrets for %s and %s", name1.c_str(), name2.c_str());
149 {
150 std::scoped_lock lock(secret_map_mutex);
151 std::string *const data1ptr = &(secret_map[name1]);
152 std::string *const data2ptr = [&]() -> std::string * {
153 if (name2.empty()) {
154 data2.clear();
155 return &data2;
156 }
157 return &(secret_map[name2]);
158 }();
159 data1 = *data1ptr;
160 data2 = *data2ptr;
161 }
162 // If we can't find either secret, load them both again
163 if (data1.empty() || (!name2.empty() && data2.empty())) {
164 std::string data1tmp;
165 std::string data2tmp;
166 this->loadSecret(name1, name2, data1tmp, data2tmp);
167 data1 = std::move(data1tmp);
168 data2 = std::move(data2tmp);
169 }
170}

Callers 3

getCTXMethod · 0.80
load_certsMethod · 0.80

Calls 4

loadSecretMethod · 0.95
c_strMethod · 0.45
emptyMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected