aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-06-17 20:28:28 +0000
committerChristian Grothoff <christian@grothoff.org>2014-06-17 20:28:28 +0000
commit36499f2179303d2b86f438b7a81d46e7320277f6 (patch)
tree89e3c689abbbf6de20f98d8da2c14ba691c8e523 /src/namestore
parent5038e93ddb399e5f7c74671a334b106a01f74e57 (diff)
downloadgnunet-36499f2179303d2b86f438b7a81d46e7320277f6.tar.gz
gnunet-36499f2179303d2b86f438b7a81d46e7320277f6.zip
-assert zone is non-null, simplify branching logic a bit
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_stop.c106
1 files changed, 52 insertions, 54 deletions
diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c
index adfd234c6..a5730ff21 100644
--- a/src/namestore/test_namestore_api_zone_iteration_stop.c
+++ b/src/namestore/test_namestore_api_zone_iteration_stop.c
@@ -178,92 +178,90 @@ zone_proc (void *cls,
178 GNUNET_SCHEDULER_add_now (&end, NULL); 178 GNUNET_SCHEDULER_add_now (&end, NULL);
179 return; 179 return;
180 } 180 }
181 else 181 GNUNET_assert (NULL != zone);
182 if (0 == memcmp (zone, privkey, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)))
182 { 183 {
183 if (0 == memcmp (zone, privkey, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) 184 if (0 == strcmp (label, s_name_1))
184 { 185 {
185 if (0 == strcmp (label, s_name_1)) 186 if (rd_count == 1)
186 { 187 {
187 if (rd_count == 1) 188 if (GNUNET_YES != GNUNET_GNSRECORD_records_cmp(rd, s_rd_1))
188 {
189 if (GNUNET_YES != GNUNET_GNSRECORD_records_cmp(rd, s_rd_1))
190 {
191 failed = GNUNET_YES;
192 GNUNET_break (0);
193 }
194 }
195 else
196 { 189 {
197 failed = GNUNET_YES; 190 failed = GNUNET_YES;
198 GNUNET_break (0); 191 GNUNET_break (0);
199 } 192 }
200 } 193 }
201 else if (0 == strcmp (label, s_name_2)) 194 else
202 { 195 {
203 if (rd_count == 1) 196 failed = GNUNET_YES;
204 { 197 GNUNET_break (0);
205 if (GNUNET_YES != GNUNET_GNSRECORD_records_cmp(rd, s_rd_2)) 198 }
206 { 199 }
207 failed = GNUNET_YES; 200 else if (0 == strcmp (label, s_name_2))
208 GNUNET_break (0); 201 {
209 } 202 if (rd_count == 1)
210 } 203 {
211 else 204 if (GNUNET_YES != GNUNET_GNSRECORD_records_cmp(rd, s_rd_2))
212 { 205 {
213 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
214 "Received invalid record count\n");
215 failed = GNUNET_YES; 206 failed = GNUNET_YES;
216 GNUNET_break (0); 207 GNUNET_break (0);
217 } 208 }
218 } 209 }
219 else 210 else
220 { 211 {
221 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 212 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
222 "Comparing result failed: got name `%s' for first zone\n", label); 213 "Received invalid record count\n");
223 failed = GNUNET_YES; 214 failed = GNUNET_YES;
224 GNUNET_break (0); 215 GNUNET_break (0);
225 } 216 }
226 } 217 }
227 else if (0 == memcmp (zone, privkey2, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) 218 else
228 { 219 {
229 if (0 == strcmp (label, s_name_3)) 220 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
221 "Comparing result failed: got name `%s' for first zone\n", label);
222 failed = GNUNET_YES;
223 GNUNET_break (0);
224 }
225 }
226 else if (0 == memcmp (zone, privkey2, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)))
227 {
228 if (0 == strcmp (label, s_name_3))
229 {
230 if (rd_count == 1)
230 { 231 {
231 if (rd_count == 1) 232 if (GNUNET_YES != GNUNET_GNSRECORD_records_cmp(rd, s_rd_3))
232 {
233 if (GNUNET_YES != GNUNET_GNSRECORD_records_cmp(rd, s_rd_3))
234 {
235 failed = GNUNET_YES;
236 GNUNET_break (0);
237 }
238 }
239 else
240 { 233 {
241 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
242 "Received invalid record count\n");
243 failed = GNUNET_YES; 234 failed = GNUNET_YES;
244 GNUNET_break (0); 235 GNUNET_break (0);
245 } 236 }
246 } 237 }
247 else 238 else
248 { 239 {
249 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 240 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
250 "Comparing result failed: got name `%s' for first zone\n", label); 241 "Received invalid record count\n");
251 failed = GNUNET_YES; 242 failed = GNUNET_YES;
252 GNUNET_break (0); 243 GNUNET_break (0);
253 } 244 }
254 } 245 }
255 else 246 else
256 { 247 {
257 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Received invalid zone\n"); 248 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
249 "Comparing result failed: got name `%s' for first zone\n", label);
258 failed = GNUNET_YES; 250 failed = GNUNET_YES;
259 GNUNET_break (0); 251 GNUNET_break (0);
260 } 252 }
253 }
254 else
255 {
256 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
257 "Received invalid zone\n");
258 failed = GNUNET_YES;
259 GNUNET_break (0);
261 } 260 }
262
263 if (failed == GNUNET_NO) 261 if (failed == GNUNET_NO)
264 { 262 {
265 if (1 == returned_records) 263 if (1 == returned_records)
266 { 264 {
267 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 265 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
268 "Telling namestore to stop zone iteration\n"); 266 "Telling namestore to stop zone iteration\n");
269 GNUNET_NAMESTORE_zone_iteration_stop (zi); 267 GNUNET_NAMESTORE_zone_iteration_stop (zi);
@@ -275,8 +273,8 @@ zone_proc (void *cls,
275 } 273 }
276 res = 0; 274 res = 0;
277 GNUNET_SCHEDULER_add_delayed (WAIT, &end, NULL); 275 GNUNET_SCHEDULER_add_delayed (WAIT, &end, NULL);
278 return; 276 return;
279 } 277 }
280 returned_records ++; 278 returned_records ++;
281 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 279 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
282 "Telling namestore to send the next result\n"); 280 "Telling namestore to send the next result\n");