Commit 207f3982 authored by Pekka Pessi's avatar Pekka Pessi
Browse files

sres_sip.c: be more robust if the DNS fails badly

Ignore-this: 1922836529de164a842ab88e848066a0

darcs-hash:20090225191024-db55f-69d3463af8fc267ba8e95f43c6ed4fd8394e9bfd.gz
parent ebfe3870
...@@ -767,24 +767,26 @@ sres_sip_send_steps(sres_sip_t *srs) ...@@ -767,24 +767,26 @@ sres_sip_send_steps(sres_sip_t *srs)
(void *)srs, sres_record_type(type, NULL), domain, (void *)srs, sres_record_type(type, NULL), domain,
answers ? " (cached)" : "")); answers ? " (cached)" : ""));
if (answers) { if (answers)
sres_sip_answer(step, NULL, answers); ;
return process = 1;
}
else if (srs->srs_blocking) { else if (srs->srs_blocking) {
sres_blocking_query(srs->srs_resolver, type, domain, 0, &answers); sres_blocking_query(srs->srs_resolver, type, domain, 0, &answers);
sres_sip_answer(step, NULL, answers);
return process = 1;
} }
else { else {
step->sp_query = sres_query(srs->srs_resolver, step->sp_query = sres_query(srs->srs_resolver,
sres_sip_answer, step, sres_sip_answer, step,
type, domain); type, domain);
/* Query all self-generated SRV records at the same time */ if (step->sp_query) {
parallel = step->sp_trace == NULL && type == sres_type_srv; /* Query all self-generated SRV records at the same time */
if (!parallel) parallel = step->sp_trace == NULL && type == sres_type_srv;
break; if (!parallel)
break;
continue;
}
} }
sres_sip_answer(step, NULL, answers);
return process = 1;
} }
return process = 0; return process = 0;
...@@ -837,7 +839,10 @@ sres_sip_status_of_answers(sres_record_t *answers[], uint16_t type) ...@@ -837,7 +839,10 @@ sres_sip_status_of_answers(sres_record_t *answers[], uint16_t type)
{ {
int i; int i;
for (i = 0; answers && answers[i]; i++) { if (answers == NULL)
return SRES_NETWORK_ERR;
for (i = 0; answers[i]; i++) {
if (answers[i]->sr_record->r_type == type) { if (answers[i]->sr_record->r_type == type) {
return answers[i]->sr_record->r_status; return answers[i]->sr_record->r_status;
} }
...@@ -956,12 +961,16 @@ sres_sip_return_results(sres_sip_t *srs, int final) ...@@ -956,12 +961,16 @@ sres_sip_return_results(sres_sip_t *srs, int final)
break; break;
case SRES_SERVER_ERR: case SRES_SERVER_ERR:
case SRES_TIMEOUT_ERR: case SRES_TIMEOUT_ERR:
case SRES_NETWORK_ERR:
srs->srs_error = SRES_SIP_ERR_AGAIN; srs->srs_error = SRES_SIP_ERR_AGAIN;
break; break;
} }
if (srs->srs_error) if (srs->srs_error)
break; break;
} }
if (!srs->srs_error)
srs->srs_error = SRES_SIP_ERR_FAIL;
} }
if (srs->srs_callback) { if (srs->srs_callback) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment