[sr-dev] git:master: core:dns_cache When dns_cache is disabled, increment dns error counter on failure

Marius Zbihlei marius.zbihlei at 1and1.ro
Fri Aug 13 10:40:00 CEST 2010


Module: sip-router
Branch: master
Commit: 7ae55b615e4e35ce47d886b6a9ae6db9865fe1f6
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7ae55b615e4e35ce47d886b6a9ae6db9865fe1f6

Author: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Date:   Fri Aug 13 11:35:51 2010 +0300

core:dns_cache When dns_cache is disabled, increment dns error counter on failure

This affects dns_resolvehost() and resolvehost() when dns_cache is disabled

---

 dns_cache.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/dns_cache.c b/dns_cache.c
index 7d52c2c..182e61f 100644
--- a/dns_cache.c
+++ b/dns_cache.c
@@ -2598,9 +2598,14 @@ error:
 struct hostent* dns_resolvehost(char* name)
 {
 	str host;
-
+        struct hostent* ret;
 	if ((cfg_get(core, core_cfg, use_dns_cache)==0) || (dns_hash==0)){ /* not init yet */
-		return _resolvehost(name);
+		ret =  _resolvehost(name);
+		if(unlikely(!ret)){
+			/* increment dns error counter */
+			counter_inc(dns_cnts_h.failed_dns_req);
+		}
+		return ret;
 	}
 	host.s=name;
 	host.len=strlen(name);




More information about the sr-dev mailing list