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

Method parentExists

src/proxy/ParentSelection.cc:231–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229}
230
231bool
232ParentConfigParams::parentExists(HttpRequestData *rdata)
233{
234 P_table *tablePtr = parent_table;
235 ParentRecord *rec = nullptr;
236 ParentResult result;
237
238 // Initialize the result structure;
239 result.reset();
240
241 tablePtr->Match(rdata, &result);
242 rec = result.rec;
243
244 if (rec == nullptr) {
245 Dbg(dbg_ctl_parent_select, "No matching parent record was found for the request.");
246 return false;
247 }
248
249 if (rec->num_parents > 0) {
250 for (int ii = 0; ii < rec->num_parents; ii++) {
251 if (rec->parents[ii].available) {
252 Dbg(dbg_ctl_parent_select, "found available parent: %s", rec->parents[ii].hostname);
253 return true;
254 }
255 }
256 }
257 if (rec->secondary_parents && rec->num_secondary_parents > 0) {
258 for (int ii = 0; ii < rec->num_secondary_parents; ii++) {
259 if (rec->secondary_parents[ii].available) {
260 Dbg(dbg_ctl_parent_select, "found available parent: %s", rec->secondary_parents[ii].hostname);
261 return true;
262 }
263 }
264 }
265 return false;
266}
267
268int ParentConfig::m_id = 0;
269

Callers 1

parentExistsFunction · 0.80

Calls 2

resetMethod · 0.45
MatchMethod · 0.45

Tested by

no test coverage detected