[Freeswitch-svn] [commit] r12284 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua/sresolv libsofia-sip-ua/sresolv/sofia-resolv

FreeSWITCH SVN mikej at freeswitch.org
Wed Feb 25 11:38:05 PST 2009


Author: mikej
Date: Wed Feb 25 13:38:05 2009
New Revision: 12284

Log:
Wed Feb 25 13:09:35 CST 2009  Pekka Pessi <first.last at 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.



Modified:
   freeswitch/trunk/libs/sofia-sip/.update
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-resolv/sres_record.h
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c

Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update	(original)
+++ freeswitch/trunk/libs/sofia-sip/.update	Wed Feb 25 13:38:05 2009
@@ -1 +1 @@
-Wed Feb 25 13:36:25 CST 2009
+Wed Feb 25 13:37:49 CST 2009

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-resolv/sres_record.h
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-resolv/sres_record.h	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sofia-resolv/sres_record.h	Wed Feb 25 13:38:05 2009
@@ -73,6 +73,7 @@
   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
 };

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c	Wed Feb 25 13:38:05 2009
@@ -1554,6 +1554,7 @@
   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 @@
   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 @@
       }
     }
 
-    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",



More information about the Freeswitch-svn mailing list