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

Function CB_Update_Secret

tests/tools/plugins/ssl_secret_load_test.cc:135–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135int
136CB_Update_Secret(TSCont cont, TSEvent /* event ATS_UNUSED */, void * /* edata ATS_UNUSED */)
137{
138 std::vector<std::string> updates;
139 for (auto iter = secret_versions.begin(); iter != secret_versions.end(); ++iter) {
140 std::string newname;
141 std::string data_item;
142 struct stat statdata;
143
144 update_file_name(iter->first, newname);
145 Dbg(dbg_ctl, "check secret for %s, really %s", iter->first.c_str(), newname.c_str());
146
147 if (stat(newname.c_str(), &statdata) < 0) {
148 continue;
149 }
150
151 if (statdata.st_mtime > iter->second) {
152 Dbg(dbg_ctl, "check secret %s has been updated", newname.c_str());
153 if (!load_file(newname, &statdata, data_item)) {
154 continue;
155 }
156 TSSslSecretSet(iter->first.c_str(), iter->first.length(), data_item.data(), data_item.size());
157 updates.push_back(iter->first);
158 iter->second = statdata.st_mtime;
159 }
160 }
161 for (auto name : updates) {
162 Dbg(dbg_ctl, "update cert for secret %s", name.c_str());
163 TSSslSecretUpdate(name.c_str(), name.length());
164 }
165 TSContScheduleOnPool(cont, 3000, TS_THREAD_POOL_TASK);
166 return TS_SUCCESS;
167}
168
169// Called by ATS as our initialization point
170void

Callers

nothing calls this directly

Calls 13

update_file_nameFunction · 0.85
load_fileFunction · 0.85
TSSslSecretSetFunction · 0.85
TSSslSecretUpdateFunction · 0.85
TSContScheduleOnPoolFunction · 0.85
statClass · 0.70
beginMethod · 0.45
endMethod · 0.45
c_strMethod · 0.45
lengthMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected