Browse code

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

Marius Zbihlei authored on 13/08/2010 08:35:51
Showing 1 changed files
... ...
@@ -2598,9 +2598,14 @@ error:
2598 2598
 struct hostent* dns_resolvehost(char* name)
2599 2599
 {
2600 2600
 	str host;
2601
-
2601
+        struct hostent* ret;
2602 2602
 	if ((cfg_get(core, core_cfg, use_dns_cache)==0) || (dns_hash==0)){ /* not init yet */
2603
-		return _resolvehost(name);
2603
+		ret =  _resolvehost(name);
2604
+		if(unlikely(!ret)){
2605
+			/* increment dns error counter */
2606
+			counter_inc(dns_cnts_h.failed_dns_req);
2607
+		}
2608
+		return ret;
2604 2609
 	}
2605 2610
 	host.s=name;
2606 2611
 	host.len=strlen(name);