summaryrefslogtreecommitdiff
path: root/auto_tests
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2015-12-15 14:58:36 -0500
committerirungentoo <irungentoo@gmail.com>2015-12-15 14:58:36 -0500
commit9a87f03aec08bebe4beed3ae4d2391a75e36393b (patch)
treede91dbdc21d3001c64de026e87daa7d64a3fcc47 /auto_tests
parent836e18075748722a64d77ad4a7dd0a9b8903bc5b (diff)
Onion test fixed to work with faster DHT.
Diffstat (limited to 'auto_tests')
-rw-r--r--auto_tests/onion_test.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/auto_tests/onion_test.c b/auto_tests/onion_test.c
index 31566471..5d59ab9b 100644
--- a/auto_tests/onion_test.c
+++ b/auto_tests/onion_test.c
@@ -331,33 +331,35 @@ uint8_t last_dht_pk[crypto_box_PUBLICKEYBYTES];
331 331
332static void dht_pk_callback(void *object, int32_t number, const uint8_t *dht_public_key) 332static void dht_pk_callback(void *object, int32_t number, const uint8_t *dht_public_key)
333{ 333{
334 Onions *on = object; 334 if ((NUM_FIRST == number && !first) || (NUM_LAST == number && !last)) {
335 uint16_t count = 0; 335 Onions *on = object;
336 int ret = DHT_addfriend(on->onion->dht, dht_public_key, &dht_ip_callback, object, number, &count); 336 uint16_t count = 0;
337 ck_assert_msg(count == 1, "Count not 1"); 337 int ret = DHT_addfriend(on->onion->dht, dht_public_key, &dht_ip_callback, object, number, &count);
338 ck_assert_msg(ret == 0, "DHT_addfriend() did not return 0"); 338 ck_assert_msg(ret == 0, "DHT_addfriend() did not return 0");
339 ck_assert_msg(count == 1, "Count not 1, count is %u", count);
339 340
340 if (NUM_FIRST == number && !first) { 341 if (NUM_FIRST == number && !first) {
341 first = 1; 342 first = 1;
342 343
343 if (memcmp(dht_public_key, last_dht_pk, crypto_box_PUBLICKEYBYTES) != 0) { 344 if (memcmp(dht_public_key, last_dht_pk, crypto_box_PUBLICKEYBYTES) != 0) {
344 ck_abort_msg("Error wrong dht key."); 345 ck_abort_msg("Error wrong dht key.");
346 }
347
348 return;
345 } 349 }
346 350
347 return; 351 if (NUM_LAST == number && !last) {
348 } 352 last = 1;
349 353
350 if (NUM_LAST == number && !last) { 354 if (memcmp(dht_public_key, first_dht_pk, crypto_box_PUBLICKEYBYTES) != 0) {
351 last = 1; 355 ck_abort_msg("Error wrong dht key.");
356 }
352 357
353 if (memcmp(dht_public_key, first_dht_pk, crypto_box_PUBLICKEYBYTES) != 0) { 358 return;
354 ck_abort_msg("Error wrong dht key.");
355 } 359 }
356 360
357 return; 361 ck_abort_msg("Error.");
358 } 362 }
359
360 ck_abort_msg("Error.");
361} 363}
362 364
363START_TEST(test_announce) 365START_TEST(test_announce)