From 733062be3aa298d697b911896ad921993124e714 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 25 Feb 2009 19:39:24 +0000 Subject: [PATCH] Wed Feb 25 13:10:24 CST 2009 Pekka Pessi * sres_sip.c: be more robust if the DNS fails badly Ignore-this: 1922836529de164a842ab88e848066a0 git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12285 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/sofia-sip/.update | 2 +- .../libsofia-sip-ua/sresolv/sres_sip.c | 31 ++++++++++++------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 636a83f2c6..e2eec4a0bb 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Wed Feb 25 13:37:49 CST 2009 +Wed Feb 25 13:39:07 CST 2009 diff --git a/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c b/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c index d38fcc74d5..55e7ea097b 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c +++ b/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c @@ -767,24 +767,26 @@ sres_sip_send_steps(sres_sip_t *srs) (void *)srs, sres_record_type(type, NULL), domain, answers ? " (cached)" : "")); - if (answers) { - sres_sip_answer(step, NULL, answers); - return process = 1; - } + if (answers) + ; else if (srs->srs_blocking) { sres_blocking_query(srs->srs_resolver, type, domain, 0, &answers); - sres_sip_answer(step, NULL, answers); - return process = 1; } else { step->sp_query = sres_query(srs->srs_resolver, sres_sip_answer, step, type, domain); - /* Query all self-generated SRV records at the same time */ - parallel = step->sp_trace == NULL && type == sres_type_srv; - if (!parallel) - break; + if (step->sp_query) { + /* Query all self-generated SRV records at the same time */ + parallel = step->sp_trace == NULL && type == sres_type_srv; + if (!parallel) + break; + continue; + } } + + sres_sip_answer(step, NULL, answers); + return process = 1; } return process = 0; @@ -837,7 +839,10 @@ sres_sip_status_of_answers(sres_record_t *answers[], uint16_t type) { 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) { return answers[i]->sr_record->r_status; } @@ -956,12 +961,16 @@ sres_sip_return_results(sres_sip_t *srs, int final) break; case SRES_SERVER_ERR: case SRES_TIMEOUT_ERR: + case SRES_NETWORK_ERR: srs->srs_error = SRES_SIP_ERR_AGAIN; break; } if (srs->srs_error) break; } + + if (!srs->srs_error) + srs->srs_error = SRES_SIP_ERR_FAIL; } if (srs->srs_callback) {