Browse code

dns_cache: remove unused err_flags variable

err_flags is deleted from the dns_rr structure.
This flag was checked sometimes, but its value was never
set. Anyway, this flag contained duplicated information
because the parent structure, dns_hash_entry, has a similar
flag (ent_flags & DNS_FLAG_BAD_NAME). And a single hash
entry cannot contain both positive and negative resource
records at the same time.

Miklos Tirpak authored on 16/06/2010 14:09:31
Showing 2 changed files
... ...
@@ -2081,7 +2081,7 @@ error:
2081 2081
 
2082 2082
 
2083 2083
 
2084
-/* gets the first non-expired, good record starting with record no
2084
+/* gets the first non-expired record starting with record no
2085 2085
  * from the dns_hash_entry struct e
2086 2086
  * params:       e   - dns_hash_entry struct
2087 2087
  *               *no - it must contain the start record number (0 initially);
... ...
@@ -2126,9 +2126,6 @@ inline static struct dns_rr* dns_entry_get_rr(	struct dns_hash_entry* e,
2126 2126
 			((s_ticks_t)(now-rr->expire)>=0) /* expired rr */
2127 2127
 		)
2128 2128
 			continue;
2129
-		if (rr->err_flags){ /* bad rr */
2130
-			continue;
2131
-		}
2132 2129
 		/* everything is ok now */
2133 2130
 		*no=n;
2134 2131
 		return rr;
... ...
@@ -2227,7 +2224,6 @@ retry:
2227 2227
 #endif
2228 2228
 			((e->ent_flags & DNS_FLAG_PERMANENT) == 0) &&
2229 2229
 			((s_ticks_t)(now-rr->expire)>=0) /* expired entry */) ||
2230
-				(rr->err_flags) /* bad rr */ ||
2231 2230
 				(srv_marked(tried, idx)) ) /* already tried */{
2232 2231
 			r_sums[idx].r_sum=0; /* 0 sum, to skip over it */
2233 2232
 			r_sums[idx].rr=0;    /* debug: mark it as unused */
... ...
@@ -3689,10 +3685,9 @@ void dns_cache_debug_all(rpc_t* rpc, void* ctx)
3689 3689
 						default:
3690 3690
 							rpc->add(ctx, "ss", "unknown", "?");
3691 3691
 					}
3692
-					rpc->add(ctx, "dd",
3692
+					rpc->add(ctx, "d",
3693 3693
 								(int)(s_ticks_t)(rr->expire-now)<0?-1:
3694
-									TICKS_TO_S(rr->expire-now),
3695
-								(int)rr->err_flags);
3694
+									TICKS_TO_S(rr->expire-now));
3696 3695
 				}
3697 3696
 			}
3698 3697
 		}
... ...
@@ -3876,8 +3871,6 @@ void dns_cache_print_entry(rpc_t* rpc, void* ctx, struct dns_hash_entry* e)
3876 3876
 		rpc->printf(ctx, "%srr expires in (s): %d", SPACE_FORMAT,
3877 3877
 						(s_ticks_t)(rr->expire-now)<0?-1 : 
3878 3878
 						TICKS_TO_S(rr->expire-now));
3879
-		rpc->printf(ctx, "%srr error flags: %d", SPACE_FORMAT, 
3880
-						rr->err_flags);
3881 3879
 	}
3882 3880
 }
3883 3881
 
... ...
@@ -135,8 +135,6 @@ struct dns_rr{
135 135
 	struct dns_rr* next;
136 136
 	void* rdata; /**< depends on the type */
137 137
 	ticks_t expire; /**< = ttl + crt_time */
138
-	unsigned char err_flags; /**< if 0 everything is ok */
139
-
140 138
 };
141 139
 
142 140