Wed Feb 25 13:09:35 CST 2009 Pekka Pessi <first.last@nokia.com>
* sres.c: improved error handling Ignore-this: a64e098f8575511bb6e5ef3129635d98 Returning records with SRES_NETWORK_ERR or SRES_TIMEOUT_ERR. Also setting errno if there is no available DNS servers. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12284 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
c49d12e184
commit
d5b2e2d2ab
|
@ -1 +1 @@
|
|||
Wed Feb 25 13:36:25 CST 2009
|
||||
Wed Feb 25 13:37:49 CST 2009
|
||||
|
|
|
@ -73,6 +73,7 @@ enum sres_status {
|
|||
SRES_TIMEOUT_ERR = 32, /**< Timeout occurred */
|
||||
SRES_RECORD_ERR = 33, /**< Name has no given record type */
|
||||
SRES_INTERNAL_ERR = 34, /**< Internal error */
|
||||
SRES_NETWORK_ERR = 35, /**< Network or DNS configuration error. */
|
||||
|
||||
_SRES_LAST_ERR
|
||||
};
|
||||
|
|
|
@ -1554,6 +1554,7 @@ char const *sres_record_status(int status, char buffer[8])
|
|||
case SRES_TIMEOUT_ERR: return "TIMEOUT_ERR";
|
||||
case SRES_RECORD_ERR: return "RECORD_ERR";
|
||||
case SRES_INTERNAL_ERR: return "INTERNAL_ERR";
|
||||
case SRES_NETWORK_ERR: return "NETWORK_ERR";
|
||||
|
||||
default:
|
||||
if (buffer)
|
||||
|
@ -2749,6 +2750,8 @@ sres_send_dns_query(sres_resolver_t *res,
|
|||
if (i0 > N) i0 = 0; /* Number of DNS servers reduced */
|
||||
dns = servers[i = i0];
|
||||
|
||||
error = EIO;
|
||||
|
||||
if (res->res_config->c_opt.rotate || dns->dns_error || dns->dns_icmp)
|
||||
dns = sres_next_server(res, &q->q_i_server, 1), i = q->q_i_server;
|
||||
|
||||
|
@ -2938,10 +2941,21 @@ sres_query_report_error(sres_query_t *q,
|
|||
}
|
||||
}
|
||||
|
||||
for (i = 0; answers[i]; i++) {
|
||||
status = answers[i]->sr_record->r_status;
|
||||
if (status)
|
||||
break;
|
||||
if (answers == NULL) {
|
||||
sres_cache_t *cache = q->q_res->res_cache;
|
||||
|
||||
status = q->q_retry_count ? SRES_TIMEOUT_ERR : SRES_NETWORK_ERR;
|
||||
|
||||
answers = su_zalloc(CHOME(cache), 2 * sizeof *answers);
|
||||
if (answers)
|
||||
answers[0] = sres_create_error_rr(cache, q, status);
|
||||
}
|
||||
else {
|
||||
for (i = 0; answers[i]; i++) {
|
||||
status = answers[i]->sr_record->r_status;
|
||||
if (status)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SU_DEBUG_5(("sres(q=%p): reporting error %s for %s %s\n",
|
||||
|
|
Loading…
Reference in New Issue