| 175 | } |
| 176 | |
| 177 | void |
| 178 | ParentConfigParams::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 | |
| 231 | bool |
| 232 | ParentConfigParams::parentExists(HttpRequestData *rdata) |
no test coverage detected