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

Method nextParent

src/proxy/ParentSelection.cc:177–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175}
176
177void
178ParentConfigParams::nextParent(HttpRequestData *rdata, ParentResult *result, unsigned int fail_threshold, unsigned int retry_time)
179{
180 P_table *tablePtr = parent_table;
181
182 Dbg(dbg_ctl_parent_select, "ParentConfigParams::nextParent(): parent_table: %p, result->rec: %p", parent_table, result->rec);
183
184 // Make sure that we are being called back with a
185 // result structure with a parent
186 ink_assert(result->result == PARENT_SPECIFIED);
187 if (result->result != PARENT_SPECIFIED) {
188 result->result = PARENT_FAIL;
189 return;
190 }
191 // If we were set through the API we currently have not failover
192 // so just return fail
193 if (result->is_api_result()) {
194 Dbg(dbg_ctl_parent_select, "Retry result for %s was %s", rdata->get_host(), ParentResultStr[result->result]);
195 result->result = PARENT_FAIL;
196 return;
197 }
198 Dbg(dbg_ctl_parent_select, "ParentConfigParams::nextParent(): result->r: %d, tablePtr: %p", result->result, tablePtr);
199
200 // Find the next parent in the array
201 Dbg(dbg_ctl_parent_select, "Calling selectParent() from nextParent");
202 selectParent(false, result, rdata, fail_threshold, retry_time);
203
204 const char *host = rdata->get_host();
205
206 if (dbg_ctl_parent_select.on()) {
207 switch (result->result) {
208 case PARENT_UNDEFINED:
209 Dbg(dbg_ctl_parent_select, "PARENT_UNDEFINED");
210 Dbg(dbg_ctl_parent_select, "Retry result for %s was %s", host, ParentResultStr[result->result]);
211 break;
212 case PARENT_FAIL:
213 Dbg(dbg_ctl_parent_select, "PARENT_FAIL");
214 Dbg(dbg_ctl_parent_select, "Retry result for %s was %s", host, ParentResultStr[result->result]);
215 break;
216 case PARENT_DIRECT:
217 Dbg(dbg_ctl_parent_select, "PARENT_DIRECT");
218 Dbg(dbg_ctl_parent_select, "Retry result for %s was %s", host, ParentResultStr[result->result]);
219 break;
220 case PARENT_SPECIFIED:
221 Dbg(dbg_ctl_parent_select, "Retry result for %s was parent %s:%d", host, result->hostname, result->port);
222 break;
223 default:
224 // Handled here:
225 // PARENT_AGENT
226 break;
227 }
228 }
229}
230
231bool
232ParentConfigParams::parentExists(HttpRequestData *rdata)

Callers 2

findServerMethod · 0.45
nextParentFunction · 0.45

Calls 3

is_api_resultMethod · 0.80
get_hostMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected