diff options
Diffstat (limited to 'src/dht/gnunet-dht-driver.c')
-rw-r--r-- | src/dht/gnunet-dht-driver.c | 42 |
1 files changed, 16 insertions, 26 deletions
diff --git a/src/dht/gnunet-dht-driver.c b/src/dht/gnunet-dht-driver.c index c0213499c..8fa5199ab 100644 --- a/src/dht/gnunet-dht-driver.c +++ b/src/dht/gnunet-dht-driver.c | |||
@@ -1407,23 +1407,12 @@ add_new_connection (struct FindPeerContext *find_peer_context, | |||
1407 | } | 1407 | } |
1408 | 1408 | ||
1409 | static void | 1409 | static void |
1410 | did_connect (void *cls, | 1410 | did_connect (void *cls, const struct GNUNET_PeerIdentity *first, |
1411 | const struct | 1411 | const struct GNUNET_PeerIdentity *second, uint32_t distance, |
1412 | GNUNET_PeerIdentity * first, | 1412 | const struct GNUNET_CONFIGURATION_Handle *first_cfg, |
1413 | const struct | 1413 | const struct GNUNET_CONFIGURATION_Handle *second_cfg, |
1414 | GNUNET_PeerIdentity * second, | 1414 | struct GNUNET_TESTING_Daemon *first_daemon, |
1415 | uint32_t distance, | 1415 | struct GNUNET_TESTING_Daemon *second_daemon, const char *emsg) |
1416 | const struct | ||
1417 | GNUNET_CONFIGURATION_Handle * | ||
1418 | first_cfg, | ||
1419 | const struct | ||
1420 | GNUNET_CONFIGURATION_Handle * | ||
1421 | second_cfg, | ||
1422 | struct GNUNET_TESTING_Daemon * | ||
1423 | first_daemon, | ||
1424 | struct GNUNET_TESTING_Daemon * | ||
1425 | second_daemon, | ||
1426 | const char *emsg) | ||
1427 | { | 1416 | { |
1428 | struct FindPeerContext *find_peer_context = cls; | 1417 | struct FindPeerContext *find_peer_context = cls; |
1429 | 1418 | ||
@@ -1457,7 +1446,8 @@ iterate_min_heap_peers (void *cls, struct GNUNET_CONTAINER_HeapNode *node, | |||
1457 | d1 = GNUNET_TESTING_daemon_get_by_id (pg, &peer_count->peer_id); | 1446 | d1 = GNUNET_TESTING_daemon_get_by_id (pg, &peer_count->peer_id); |
1458 | GNUNET_assert (d1 != NULL); | 1447 | GNUNET_assert (d1 != NULL); |
1459 | d2 = d1; | 1448 | d2 = d1; |
1460 | while ((d2 == d1) || (GNUNET_YES != GNUNET_TESTING_test_daemon_running (d2))) | 1449 | while ((d2 == d1) || |
1450 | (GNUNET_YES != GNUNET_TESTING_test_daemon_running (d2))) | ||
1461 | { | 1451 | { |
1462 | d2 = GNUNET_TESTING_daemon_get (pg, | 1452 | d2 = GNUNET_TESTING_daemon_get (pg, |
1463 | GNUNET_CRYPTO_random_u32 | 1453 | GNUNET_CRYPTO_random_u32 |
@@ -1479,10 +1469,10 @@ iterate_min_heap_peers (void *cls, struct GNUNET_CONTAINER_HeapNode *node, | |||
1479 | } | 1469 | } |
1480 | if (NULL != find_peer_context->cc) | 1470 | if (NULL != find_peer_context->cc) |
1481 | GNUNET_TESTING_daemons_connect_cancel (find_peer_context->cc); | 1471 | GNUNET_TESTING_daemons_connect_cancel (find_peer_context->cc); |
1482 | find_peer_context->cc = GNUNET_TESTING_daemons_connect (d1, d2, timeout, DEFAULT_RECONNECT_ATTEMPTS, | 1472 | find_peer_context->cc = |
1483 | GNUNET_YES, | 1473 | GNUNET_TESTING_daemons_connect (d1, d2, timeout, |
1484 | &did_connect, | 1474 | DEFAULT_RECONNECT_ATTEMPTS, GNUNET_YES, |
1485 | find_peer_context); | 1475 | &did_connect, find_peer_context); |
1486 | } | 1476 | } |
1487 | if (GNUNET_TIME_absolute_get_remaining (find_peer_context->endtime).rel_value | 1477 | if (GNUNET_TIME_absolute_get_remaining (find_peer_context->endtime).rel_value |
1488 | > 0) | 1478 | > 0) |
@@ -1602,7 +1592,7 @@ count_peers_churn_cb (void *cls, const struct GNUNET_PeerIdentity *first, | |||
1602 | GNUNET_CONTAINER_multihashmap_destroy (find_peer_context->peer_hash); | 1592 | GNUNET_CONTAINER_multihashmap_destroy (find_peer_context->peer_hash); |
1603 | GNUNET_CONTAINER_heap_destroy (find_peer_context->peer_min_heap); | 1593 | GNUNET_CONTAINER_heap_destroy (find_peer_context->peer_min_heap); |
1604 | if (NULL != find_peer_context->cc) | 1594 | if (NULL != find_peer_context->cc) |
1605 | GNUNET_TESTING_daemons_connect_cancel (find_peer_context->cc); | 1595 | GNUNET_TESTING_daemons_connect_cancel (find_peer_context->cc); |
1606 | GNUNET_free (find_peer_context); | 1596 | GNUNET_free (find_peer_context); |
1607 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1597 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1608 | "Churn round %u of %llu finished, scheduling next GET round.\n", | 1598 | "Churn round %u of %llu finished, scheduling next GET round.\n", |
@@ -2120,7 +2110,7 @@ do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2120 | /* Set this here in case we are re-running gets */ | 2110 | /* Set this here in case we are re-running gets */ |
2121 | test_get->succeeded = GNUNET_NO; | 2111 | test_get->succeeded = GNUNET_NO; |
2122 | 2112 | ||
2123 | if (GNUNET_YES != GNUNET_TESTING_test_daemon_running (test_get->daemon)) /* If the peer has been churned off, don't try issuing request from it! */ | 2113 | if (GNUNET_YES != GNUNET_TESTING_test_daemon_running (test_get->daemon)) /* If the peer has been churned off, don't try issuing request from it! */ |
2124 | { | 2114 | { |
2125 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2115 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2126 | "Peer we should issue get request from is down, skipping.\n"); | 2116 | "Peer we should issue get request from is down, skipping.\n"); |
@@ -2237,7 +2227,7 @@ do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
2237 | if (test_put == NULL) | 2227 | if (test_put == NULL) |
2238 | return; /* End of list */ | 2228 | return; /* End of list */ |
2239 | 2229 | ||
2240 | if (GNUNET_YES != GNUNET_TESTING_test_daemon_running (test_put->daemon)) /* If the peer has been churned off, don't try issuing request from it! */ | 2230 | if (GNUNET_YES != GNUNET_TESTING_test_daemon_running (test_put->daemon)) /* If the peer has been churned off, don't try issuing request from it! */ |
2241 | { | 2231 | { |
2242 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2232 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2243 | "Peer we should issue put request at is down, skipping.\n"); | 2233 | "Peer we should issue put request at is down, skipping.\n"); |
@@ -2357,7 +2347,7 @@ count_peers_cb (void *cls, const struct GNUNET_PeerIdentity *first, | |||
2357 | GNUNET_CONTAINER_multihashmap_destroy (find_peer_context->peer_hash); | 2347 | GNUNET_CONTAINER_multihashmap_destroy (find_peer_context->peer_hash); |
2358 | GNUNET_CONTAINER_heap_destroy (find_peer_context->peer_min_heap); | 2348 | GNUNET_CONTAINER_heap_destroy (find_peer_context->peer_min_heap); |
2359 | if (NULL != find_peer_context->cc) | 2349 | if (NULL != find_peer_context->cc) |
2360 | GNUNET_TESTING_daemons_connect_cancel (find_peer_context->cc); | 2350 | GNUNET_TESTING_daemons_connect_cancel (find_peer_context->cc); |
2361 | GNUNET_free (find_peer_context); | 2351 | GNUNET_free (find_peer_context); |
2362 | fprintf (stderr, "Not sending any more find peer requests.\n"); | 2352 | fprintf (stderr, "Not sending any more find peer requests.\n"); |
2363 | 2353 | ||