aboutsummaryrefslogtreecommitdiff
path: root/src/dht/gnunet-dht-driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht/gnunet-dht-driver.c')
-rw-r--r--src/dht/gnunet-dht-driver.c1029
1 files changed, 514 insertions, 515 deletions
diff --git a/src/dht/gnunet-dht-driver.c b/src/dht/gnunet-dht-driver.c
index a5158fba5..d58e49e3b 100644
--- a/src/dht/gnunet-dht-driver.c
+++ b/src/dht/gnunet-dht-driver.c
@@ -850,8 +850,8 @@ update_meter (struct ProgressMeter *meter)
850 fprintf (stdout, "%sProgress: [0%%", meter->startup_string); 850 fprintf (stdout, "%sProgress: [0%%", meter->startup_string);
851 } 851 }
852 else 852 else
853 fprintf (stdout, "%d%%", (int) (((float) meter->completed 853 fprintf (stdout, "%d%%",
854 / meter->total) * 100)); 854 (int) (((float) meter->completed / meter->total) * 100));
855 } 855 }
856 else if (meter->completed % meter->dotnum == 0) 856 else if (meter->completed % meter->dotnum == 0)
857 fprintf (stdout, "."); 857 fprintf (stdout, ".");
@@ -922,10 +922,10 @@ put_disconnect_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
922 GNUNET_DHT_disconnect (test_put->dht_handle); 922 GNUNET_DHT_disconnect (test_put->dht_handle);
923 test_put->dht_handle = NULL; 923 test_put->dht_handle = NULL;
924 if (replicate_same == GNUNET_NO) 924 if (replicate_same == GNUNET_NO)
925 test_put->daemon 925 test_put->daemon =
926 = GNUNET_TESTING_daemon_get (pg, 926 GNUNET_TESTING_daemon_get (pg,
927 GNUNET_CRYPTO_random_u32 927 GNUNET_CRYPTO_random_u32
928 (GNUNET_CRYPTO_QUALITY_WEAK, num_peers)); 928 (GNUNET_CRYPTO_QUALITY_WEAK, num_peers));
929} 929}
930 930
931/** 931/**
@@ -1010,11 +1010,10 @@ log_topology_cb (void *cls, const struct GNUNET_PeerIdentity *first,
1010 1010
1011 if ((first != NULL) && (second != NULL)) 1011 if ((first != NULL) && (second != NULL))
1012 { 1012 {
1013 if ((topo_ctx->peers_seen != NULL) && (GNUNET_NO 1013 if ((topo_ctx->peers_seen != NULL) &&
1014 == 1014 (GNUNET_NO ==
1015 GNUNET_CONTAINER_multihashmap_contains 1015 GNUNET_CONTAINER_multihashmap_contains (topo_ctx->peers_seen,
1016 (topo_ctx->peers_seen, 1016 &first->hashPubKey)))
1017 &first->hashPubKey)))
1018 { 1017 {
1019 GNUNET_CONTAINER_multihashmap_put (topo_ctx->peers_seen, 1018 GNUNET_CONTAINER_multihashmap_put (topo_ctx->peers_seen,
1020 &first->hashPubKey, NULL, 1019 &first->hashPubKey, NULL,
@@ -1109,15 +1108,14 @@ stats_handle (void *cls, const struct GNUNET_PeerIdentity *peer,
1109 dhtlog_handle->add_generic_stat (peer, name, subsystem, value); 1108 dhtlog_handle->add_generic_stat (peer, name, subsystem, value);
1110 if (GNUNET_CONTAINER_multihashmap_contains (stats_map, &peer->hashPubKey)) 1109 if (GNUNET_CONTAINER_multihashmap_contains (stats_map, &peer->hashPubKey))
1111 { 1110 {
1112 stats_ctx = GNUNET_CONTAINER_multihashmap_get (stats_map, 1111 stats_ctx =
1113 &peer->hashPubKey); 1112 GNUNET_CONTAINER_multihashmap_get (stats_map, &peer->hashPubKey);
1114 } 1113 }
1115 else 1114 else
1116 { 1115 {
1117 stats_ctx = GNUNET_malloc (sizeof (struct StatisticsIteratorContext)); 1116 stats_ctx = GNUNET_malloc (sizeof (struct StatisticsIteratorContext));
1118 stats_ctx->peer = peer; 1117 stats_ctx->peer = peer;
1119 GNUNET_CONTAINER_multihashmap_put (stats_map, &peer->hashPubKey, 1118 GNUNET_CONTAINER_multihashmap_put (stats_map, &peer->hashPubKey, stats_ctx,
1120 stats_ctx,
1121 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); 1119 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
1122 } 1120 }
1123 GNUNET_assert (stats_ctx != NULL); 1121 GNUNET_assert (stats_ctx != NULL);
@@ -1329,8 +1327,8 @@ send_find_peer_request (void *cls,
1329{ 1327{
1330 struct TestFindPeer *test_find_peer = cls; 1328 struct TestFindPeer *test_find_peer = cls;
1331 1329
1332 if (test_find_peer->find_peer_context->outstanding 1330 if (test_find_peer->find_peer_context->outstanding >
1333 > max_outstanding_find_peers) 1331 max_outstanding_find_peers)
1334 { 1332 {
1335 GNUNET_SCHEDULER_add_delayed (find_peer_offset, &send_find_peer_request, 1333 GNUNET_SCHEDULER_add_delayed (find_peer_offset, &send_find_peer_request,
1336 test_find_peer); 1334 test_find_peer);
@@ -1345,8 +1343,8 @@ send_find_peer_request (void *cls,
1345 return; 1343 return;
1346 } 1344 }
1347 1345
1348 test_find_peer->dht_handle = GNUNET_DHT_connect (test_find_peer->daemon->cfg, 1346 test_find_peer->dht_handle =
1349 1); 1347 GNUNET_DHT_connect (test_find_peer->daemon->cfg, 1);
1350 GNUNET_assert (test_find_peer->dht_handle != NULL); 1348 GNUNET_assert (test_find_peer->dht_handle != NULL);
1351 GNUNET_DHT_find_peers (test_find_peer->dht_handle, &handle_find_peer_sent, 1349 GNUNET_DHT_find_peers (test_find_peer->dht_handle, &handle_find_peer_sent,
1352 test_find_peer); 1350 test_find_peer);
@@ -1365,12 +1363,12 @@ add_new_connection (struct FindPeerContext *find_peer_context,
1365 struct PeerCount *first_count; 1363 struct PeerCount *first_count;
1366 struct PeerCount *second_count; 1364 struct PeerCount *second_count;
1367 1365
1368 if (GNUNET_CONTAINER_multihashmap_contains (find_peer_context->peer_hash, 1366 if (GNUNET_CONTAINER_multihashmap_contains
1369 &first->hashPubKey)) 1367 (find_peer_context->peer_hash, &first->hashPubKey))
1370 { 1368 {
1371 first_count 1369 first_count =
1372 = GNUNET_CONTAINER_multihashmap_get (find_peer_context->peer_hash, 1370 GNUNET_CONTAINER_multihashmap_get (find_peer_context->peer_hash,
1373 &first->hashPubKey); 1371 &first->hashPubKey);
1374 GNUNET_assert (first_count != NULL); 1372 GNUNET_assert (first_count != NULL);
1375 first_count->count++; 1373 first_count->count++;
1376 GNUNET_CONTAINER_heap_update_cost (find_peer_context->peer_min_heap, 1374 GNUNET_CONTAINER_heap_update_cost (find_peer_context->peer_min_heap,
@@ -1382,20 +1380,20 @@ add_new_connection (struct FindPeerContext *find_peer_context,
1382 first_count = GNUNET_malloc (sizeof (struct PeerCount)); 1380 first_count = GNUNET_malloc (sizeof (struct PeerCount));
1383 first_count->count = 1; 1381 first_count->count = 1;
1384 memcpy (&first_count->peer_id, first, sizeof (struct GNUNET_PeerIdentity)); 1382 memcpy (&first_count->peer_id, first, sizeof (struct GNUNET_PeerIdentity));
1385 first_count->heap_node 1383 first_count->heap_node =
1386 = GNUNET_CONTAINER_heap_insert (find_peer_context->peer_min_heap, 1384 GNUNET_CONTAINER_heap_insert (find_peer_context->peer_min_heap,
1387 first_count, first_count->count); 1385 first_count, first_count->count);
1388 GNUNET_CONTAINER_multihashmap_put (find_peer_context->peer_hash, 1386 GNUNET_CONTAINER_multihashmap_put (find_peer_context->peer_hash,
1389 &first->hashPubKey, first_count, 1387 &first->hashPubKey, first_count,
1390 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); 1388 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
1391 } 1389 }
1392 1390
1393 if (GNUNET_CONTAINER_multihashmap_contains (find_peer_context->peer_hash, 1391 if (GNUNET_CONTAINER_multihashmap_contains
1394 &second->hashPubKey)) 1392 (find_peer_context->peer_hash, &second->hashPubKey))
1395 { 1393 {
1396 second_count 1394 second_count =
1397 = GNUNET_CONTAINER_multihashmap_get (find_peer_context->peer_hash, 1395 GNUNET_CONTAINER_multihashmap_get (find_peer_context->peer_hash,
1398 &second->hashPubKey); 1396 &second->hashPubKey);
1399 GNUNET_assert (second_count != NULL); 1397 GNUNET_assert (second_count != NULL);
1400 second_count->count++; 1398 second_count->count++;
1401 GNUNET_CONTAINER_heap_update_cost (find_peer_context->peer_min_heap, 1399 GNUNET_CONTAINER_heap_update_cost (find_peer_context->peer_min_heap,
@@ -1408,9 +1406,9 @@ add_new_connection (struct FindPeerContext *find_peer_context,
1408 second_count->count = 1; 1406 second_count->count = 1;
1409 memcpy (&second_count->peer_id, second, 1407 memcpy (&second_count->peer_id, second,
1410 sizeof (struct GNUNET_PeerIdentity)); 1408 sizeof (struct GNUNET_PeerIdentity));
1411 second_count->heap_node 1409 second_count->heap_node =
1412 = GNUNET_CONTAINER_heap_insert (find_peer_context->peer_min_heap, 1410 GNUNET_CONTAINER_heap_insert (find_peer_context->peer_min_heap,
1413 second_count, second_count->count); 1411 second_count, second_count->count);
1414 GNUNET_CONTAINER_multihashmap_put (find_peer_context->peer_hash, 1412 GNUNET_CONTAINER_multihashmap_put (find_peer_context->peer_hash,
1415 &second->hashPubKey, second_count, 1413 &second->hashPubKey, second_count,
1416 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); 1414 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
@@ -1456,19 +1454,19 @@ iterate_min_heap_peers (void *cls, struct GNUNET_CONTAINER_HeapNode *node,
1456 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1454 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1457 "Peer %s has 0 connections. Trying to connect to %s...\n", 1455 "Peer %s has 0 connections. Trying to connect to %s...\n",
1458 GNUNET_i2s (&peer_count->peer_id), d2->shortname); 1456 GNUNET_i2s (&peer_count->peer_id), d2->shortname);
1459 timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1457 timeout =
1460 DEFAULT_CONNECT_TIMEOUT); 1458 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
1461 if (GNUNET_TIME_relative_to_absolute (timeout).abs_value 1459 DEFAULT_CONNECT_TIMEOUT);
1462 > find_peer_context->endtime.abs_value) 1460 if (GNUNET_TIME_relative_to_absolute (timeout).abs_value >
1461 find_peer_context->endtime.abs_value)
1463 { 1462 {
1464 timeout = GNUNET_TIME_absolute_get_remaining (find_peer_context->endtime); 1463 timeout = GNUNET_TIME_absolute_get_remaining (find_peer_context->endtime);
1465 } 1464 }
1466 GNUNET_TESTING_daemons_connect (d1, d2, timeout, 1465 GNUNET_TESTING_daemons_connect (d1, d2, timeout, DEFAULT_RECONNECT_ATTEMPTS,
1467 DEFAULT_RECONNECT_ATTEMPTS, GNUNET_YES, 1466 GNUNET_YES, NULL, NULL);
1468 NULL, NULL);
1469 } 1467 }
1470 if (GNUNET_TIME_absolute_get_remaining (find_peer_context->endtime).rel_value 1468 if (GNUNET_TIME_absolute_get_remaining (find_peer_context->endtime).
1471 > 0) 1469 rel_value > 0)
1472 return GNUNET_YES; 1470 return GNUNET_YES;
1473 else 1471 else
1474 return GNUNET_NO; 1472 return GNUNET_NO;
@@ -1477,10 +1475,10 @@ iterate_min_heap_peers (void *cls, struct GNUNET_CONTAINER_HeapNode *node,
1477/** 1475/**
1478 * Forward declaration. 1476 * Forward declaration.
1479 */ 1477 */
1480static void 1478static void schedule_churn_find_peer_requests (void *cls,
1481schedule_churn_find_peer_requests (void *cls, 1479 const struct
1482 const struct GNUNET_SCHEDULER_TaskContext 1480 GNUNET_SCHEDULER_TaskContext
1483 *tc); 1481 *tc);
1484 1482
1485/** 1483/**
1486 * Callback for iterating over all the peer connections of a peer group. 1484 * Callback for iterating over all the peer connections of a peer group.
@@ -1557,11 +1555,12 @@ count_peers_churn_cb (void *cls, const struct GNUNET_PeerIdentity *first,
1557 */ 1555 */
1558 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1556 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1559 "Out of %u peers, fewest connections is %d\n", 1557 "Out of %u peers, fewest connections is %d\n",
1560 GNUNET_CONTAINER_heap_get_size 1558 GNUNET_CONTAINER_heap_get_size (find_peer_context->
1561 (find_peer_context->peer_min_heap), peer_count->count); 1559 peer_min_heap),
1560 peer_count->count);
1562 if ((peer_count->count == 0) && 1561 if ((peer_count->count == 0) &&
1563 (GNUNET_TIME_absolute_get_remaining 1562 (GNUNET_TIME_absolute_get_remaining (find_peer_context->endtime).
1564 (find_peer_context->endtime).rel_value > 0)) 1563 rel_value > 0))
1565 { 1564 {
1566 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1565 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1567 "Found peer with no connections, will choose some peer(s) at random to connect to!\n"); 1566 "Found peer with no connections, will choose some peer(s) at random to connect to!\n");
@@ -1571,9 +1570,8 @@ count_peers_churn_cb (void *cls, const struct GNUNET_PeerIdentity *first,
1571 GNUNET_SCHEDULER_add_now (&schedule_churn_find_peer_requests, 1570 GNUNET_SCHEDULER_add_now (&schedule_churn_find_peer_requests,
1572 find_peer_context); 1571 find_peer_context);
1573 } 1572 }
1574 else if ((GNUNET_TIME_absolute_get_remaining 1573 else if ((GNUNET_TIME_absolute_get_remaining (find_peer_context->endtime).
1575 (find_peer_context->endtime).rel_value > 0) && 1574 rel_value > 0) && (find_peer_context->last_sent != 0))
1576 (find_peer_context->last_sent != 0))
1577 { 1575 {
1578 GNUNET_SCHEDULER_add_now (&schedule_churn_find_peer_requests, 1576 GNUNET_SCHEDULER_add_now (&schedule_churn_find_peer_requests,
1579 find_peer_context); 1577 find_peer_context);
@@ -1596,8 +1594,7 @@ count_peers_churn_cb (void *cls, const struct GNUNET_PeerIdentity *first,
1596 topo_ctx->cls = all_gets; 1594 topo_ctx->cls = all_gets;
1597 topo_ctx->timeout = DEFAULT_GET_TIMEOUT; 1595 topo_ctx->timeout = DEFAULT_GET_TIMEOUT;
1598 topo_ctx->peers_seen = GNUNET_CONTAINER_multihashmap_create (num_peers); 1596 topo_ctx->peers_seen = GNUNET_CONTAINER_multihashmap_create (num_peers);
1599 die_task 1597 die_task =
1600 =
1601 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_add 1598 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_add
1602 (GNUNET_TIME_relative_add 1599 (GNUNET_TIME_relative_add
1603 (DEFAULT_GET_TIMEOUT, 1600 (DEFAULT_GET_TIMEOUT,
@@ -1609,8 +1606,7 @@ count_peers_churn_cb (void *cls, const struct GNUNET_PeerIdentity *first,
1609 } 1606 }
1610 else 1607 else
1611 { 1608 {
1612 die_task 1609 die_task =
1613 =
1614 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_add 1610 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_add
1615 (GNUNET_TIME_relative_add 1611 (GNUNET_TIME_relative_add
1616 (DEFAULT_GET_TIMEOUT, 1612 (DEFAULT_GET_TIMEOUT,
@@ -1641,12 +1637,12 @@ schedule_churn_find_peer_requests (void *cls,
1641 1637
1642 if (find_peer_ctx->previous_peers == 0) /* First time, go slowly */ 1638 if (find_peer_ctx->previous_peers == 0) /* First time, go slowly */
1643 find_peer_ctx->total = 1; 1639 find_peer_ctx->total = 1;
1644 else if (find_peer_ctx->current_peers - find_peer_ctx->previous_peers 1640 else if (find_peer_ctx->current_peers - find_peer_ctx->previous_peers <
1645 < MIN_FIND_PEER_CUTOFF) 1641 MIN_FIND_PEER_CUTOFF)
1646 find_peer_ctx->total = find_peer_ctx->total / 2; 1642 find_peer_ctx->total = find_peer_ctx->total / 2;
1647 else if (find_peer_ctx->current_peers - find_peer_ctx->previous_peers > MAX_FIND_PEER_CUTOFF) /* Found LOTS of peers, still go slowly */ 1643 else if (find_peer_ctx->current_peers - find_peer_ctx->previous_peers > MAX_FIND_PEER_CUTOFF) /* Found LOTS of peers, still go slowly */
1648 find_peer_ctx->total = find_peer_ctx->last_sent - (find_peer_ctx->last_sent 1644 find_peer_ctx->total =
1649 / 4); 1645 find_peer_ctx->last_sent - (find_peer_ctx->last_sent / 4);
1650 else 1646 else
1651 find_peer_ctx->total = find_peer_ctx->last_sent * 4; 1647 find_peer_ctx->total = find_peer_ctx->last_sent * 4;
1652 1648
@@ -1659,8 +1655,8 @@ schedule_churn_find_peer_requests (void *cls,
1659 find_peer_ctx->total); 1655 find_peer_ctx->total);
1660 1656
1661 if (find_peer_ctx->total > 0) 1657 if (find_peer_ctx->total > 0)
1662 find_peer_offset = GNUNET_TIME_relative_divide (find_peer_delay, 1658 find_peer_offset =
1663 find_peer_ctx->total); 1659 GNUNET_TIME_relative_divide (find_peer_delay, find_peer_ctx->total);
1664 else 1660 else
1665 { 1661 {
1666 find_peer_ctx->previous_peers = find_peer_ctx->current_peers; 1662 find_peer_ctx->previous_peers = find_peer_ctx->current_peers;
@@ -1672,8 +1668,8 @@ schedule_churn_find_peer_requests (void *cls,
1672 { 1668 {
1673 test_find_peer = GNUNET_malloc (sizeof (struct TestFindPeer)); 1669 test_find_peer = GNUNET_malloc (sizeof (struct TestFindPeer));
1674 /* If we have sent requests, choose peers with a low number of connections to send requests from */ 1670 /* If we have sent requests, choose peers with a low number of connections to send requests from */
1675 peer_count 1671 peer_count =
1676 = GNUNET_CONTAINER_heap_remove_root (find_peer_ctx->peer_min_heap); 1672 GNUNET_CONTAINER_heap_remove_root (find_peer_ctx->peer_min_heap);
1677 GNUNET_assert (peer_count != NULL); 1673 GNUNET_assert (peer_count != NULL);
1678 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1674 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1679 "Sending find peer request from peer with %u connections\n", 1675 "Sending find peer request from peer with %u connections\n",
@@ -1681,8 +1677,8 @@ schedule_churn_find_peer_requests (void *cls,
1681 GNUNET_CONTAINER_multihashmap_remove (find_peer_ctx->peer_hash, 1677 GNUNET_CONTAINER_multihashmap_remove (find_peer_ctx->peer_hash,
1682 &peer_count->peer_id.hashPubKey, 1678 &peer_count->peer_id.hashPubKey,
1683 peer_count); 1679 peer_count);
1684 test_find_peer->daemon 1680 test_find_peer->daemon =
1685 = GNUNET_TESTING_daemon_get_by_id (pg, &peer_count->peer_id); 1681 GNUNET_TESTING_daemon_get_by_id (pg, &peer_count->peer_id);
1686 GNUNET_assert (test_find_peer->daemon != NULL); 1682 GNUNET_assert (test_find_peer->daemon != NULL);
1687 test_find_peer->find_peer_context = find_peer_ctx; 1683 test_find_peer->find_peer_context = find_peer_ctx;
1688 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 1684 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
@@ -1690,12 +1686,12 @@ schedule_churn_find_peer_requests (void *cls,
1690 &send_find_peer_request, test_find_peer); 1686 &send_find_peer_request, test_find_peer);
1691 } 1687 }
1692 1688
1693 if ((find_peer_ctx->peer_hash == NULL) && (find_peer_ctx->peer_min_heap 1689 if ((find_peer_ctx->peer_hash == NULL) &&
1694 == NULL)) 1690 (find_peer_ctx->peer_min_heap == NULL))
1695 { 1691 {
1696 find_peer_ctx->peer_hash = GNUNET_CONTAINER_multihashmap_create (num_peers); 1692 find_peer_ctx->peer_hash = GNUNET_CONTAINER_multihashmap_create (num_peers);
1697 find_peer_ctx->peer_min_heap 1693 find_peer_ctx->peer_min_heap =
1698 = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); 1694 GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
1699 } 1695 }
1700 else 1696 else
1701 { 1697 {
@@ -1764,9 +1760,9 @@ churn_complete (void *cls, const char *emsg)
1764 memcpy (&peer_count->peer_id, &temp_daemon->id, 1760 memcpy (&peer_count->peer_id, &temp_daemon->id,
1765 sizeof (struct GNUNET_PeerIdentity)); 1761 sizeof (struct GNUNET_PeerIdentity));
1766 GNUNET_assert (peer_count->count == 0); 1762 GNUNET_assert (peer_count->count == 0);
1767 peer_count->heap_node 1763 peer_count->heap_node =
1768 = GNUNET_CONTAINER_heap_insert (find_peer_context->peer_min_heap, 1764 GNUNET_CONTAINER_heap_insert (find_peer_context->peer_min_heap,
1769 peer_count, peer_count->count); 1765 peer_count, peer_count->count);
1770 GNUNET_CONTAINER_multihashmap_put (find_peer_context->peer_hash, 1766 GNUNET_CONTAINER_multihashmap_put (find_peer_context->peer_hash,
1771 &temp_daemon->id.hashPubKey, 1767 &temp_daemon->id.hashPubKey,
1772 peer_count, 1768 peer_count,
@@ -1775,10 +1771,9 @@ churn_complete (void *cls, const char *emsg)
1775 } 1771 }
1776 } 1772 }
1777 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1773 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1778 "Added %d peers to heap, total size %d\n", 1774 "Added %d peers to heap, total size %d\n", count_added,
1779 count_added, 1775 GNUNET_CONTAINER_heap_get_size (find_peer_context->
1780 GNUNET_CONTAINER_heap_get_size 1776 peer_min_heap));
1781 (find_peer_context->peer_min_heap));
1782 GNUNET_SCHEDULER_add_delayed (DEFAULT_PEER_DISCONNECT_TIMEOUT, 1777 GNUNET_SCHEDULER_add_delayed (DEFAULT_PEER_DISCONNECT_TIMEOUT,
1783 &schedule_churn_get_topology, 1778 &schedule_churn_get_topology,
1784 find_peer_context); 1779 find_peer_context);
@@ -1794,33 +1789,33 @@ churn_complete (void *cls, const char *emsg)
1794 topo_ctx->cls = all_gets; 1789 topo_ctx->cls = all_gets;
1795 topo_ctx->timeout = DEFAULT_GET_TIMEOUT; 1790 topo_ctx->timeout = DEFAULT_GET_TIMEOUT;
1796 topo_ctx->peers_seen = GNUNET_CONTAINER_multihashmap_create (num_peers); 1791 topo_ctx->peers_seen = GNUNET_CONTAINER_multihashmap_create (num_peers);
1797 calc_timeout = GNUNET_TIME_relative_add (DEFAULT_GET_TIMEOUT, 1792 calc_timeout =
1798 all_get_timeout); 1793 GNUNET_TIME_relative_add (DEFAULT_GET_TIMEOUT, all_get_timeout);
1799 calc_timeout 1794 calc_timeout =
1800 = GNUNET_TIME_relative_add (calc_timeout, 1795 GNUNET_TIME_relative_add (calc_timeout,
1801 DEFAULT_TOPOLOGY_CAPTURE_TIMEOUT); 1796 DEFAULT_TOPOLOGY_CAPTURE_TIMEOUT);
1802 calc_timeout 1797 calc_timeout =
1803 = GNUNET_TIME_relative_add (calc_timeout, 1798 GNUNET_TIME_relative_add (calc_timeout,
1804 DEFAULT_PEER_DISCONNECT_TIMEOUT); 1799 DEFAULT_PEER_DISCONNECT_TIMEOUT);
1805 die_task 1800 die_task =
1806 = GNUNET_SCHEDULER_add_delayed (calc_timeout, &end_badly, 1801 GNUNET_SCHEDULER_add_delayed (calc_timeout, &end_badly,
1807 "from do gets (churn_complete)"); 1802 "from do gets (churn_complete)");
1808 GNUNET_SCHEDULER_add_delayed (DEFAULT_PEER_DISCONNECT_TIMEOUT, 1803 GNUNET_SCHEDULER_add_delayed (DEFAULT_PEER_DISCONNECT_TIMEOUT,
1809 &capture_current_topology, topo_ctx); 1804 &capture_current_topology, topo_ctx);
1810 dhtlog_handle->insert_round (DHT_ROUND_GET, rounds_finished); 1805 dhtlog_handle->insert_round (DHT_ROUND_GET, rounds_finished);
1811 } 1806 }
1812 else 1807 else
1813 { 1808 {
1814 calc_timeout = GNUNET_TIME_relative_add (DEFAULT_GET_TIMEOUT, 1809 calc_timeout =
1815 all_get_timeout); 1810 GNUNET_TIME_relative_add (DEFAULT_GET_TIMEOUT, all_get_timeout);
1816 calc_timeout 1811 calc_timeout =
1817 = GNUNET_TIME_relative_add (calc_timeout, 1812 GNUNET_TIME_relative_add (calc_timeout,
1818 DEFAULT_PEER_DISCONNECT_TIMEOUT); 1813 DEFAULT_PEER_DISCONNECT_TIMEOUT);
1819 die_task 1814 die_task =
1820 = GNUNET_SCHEDULER_add_delayed (calc_timeout, &end_badly, 1815 GNUNET_SCHEDULER_add_delayed (calc_timeout, &end_badly,
1821 "from do gets (churn_complete)"); 1816 "from do gets (churn_complete)");
1822 GNUNET_SCHEDULER_add_delayed (DEFAULT_PEER_DISCONNECT_TIMEOUT, 1817 GNUNET_SCHEDULER_add_delayed (DEFAULT_PEER_DISCONNECT_TIMEOUT, &do_get,
1823 &do_get, all_gets); 1818 all_gets);
1824 } 1819 }
1825 } 1820 }
1826} 1821}
@@ -1880,10 +1875,10 @@ churn_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1880 find_peer_context->previous_peers = 0; 1875 find_peer_context->previous_peers = 0;
1881 find_peer_context->current_peers = 0; 1876 find_peer_context->current_peers = 0;
1882 find_peer_context->endtime = GNUNET_TIME_relative_to_absolute (timeout); 1877 find_peer_context->endtime = GNUNET_TIME_relative_to_absolute (timeout);
1883 find_peer_context->peer_hash 1878 find_peer_context->peer_hash =
1884 = GNUNET_CONTAINER_multihashmap_create (num_peers); 1879 GNUNET_CONTAINER_multihashmap_create (num_peers);
1885 find_peer_context->peer_min_heap 1880 find_peer_context->peer_min_heap =
1886 = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); 1881 GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
1887 } 1882 }
1888 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1883 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1889 "churn_peers: want %u total, %u running, starting %u, stopping %u\n", 1884 "churn_peers: want %u total, %u running, starting %u, stopping %u\n",
@@ -1914,12 +1909,12 @@ get_stop_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1914 /* Reset the uid (which item to search for) and the daemon (which peer to search from) for later get request iterations */ 1909 /* Reset the uid (which item to search for) and the daemon (which peer to search from) for later get request iterations */
1915 if (get_from_same == GNUNET_NO) 1910 if (get_from_same == GNUNET_NO)
1916 { 1911 {
1917 test_get->uid = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 1912 test_get->uid =
1918 num_puts); 1913 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, num_puts);
1919 test_get->daemon 1914 test_get->daemon =
1920 = GNUNET_TESTING_daemon_get (pg, 1915 GNUNET_TESTING_daemon_get (pg,
1921 GNUNET_CRYPTO_random_u32 1916 GNUNET_CRYPTO_random_u32
1922 (GNUNET_CRYPTO_QUALITY_WEAK, num_peers)); 1917 (GNUNET_CRYPTO_QUALITY_WEAK, num_peers));
1923 } 1918 }
1924 1919
1925#if VERBOSE > 1 1920#if VERBOSE > 1
@@ -1986,8 +1981,7 @@ get_stop_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1986 if (dhtlog_handle != NULL) 1981 if (dhtlog_handle != NULL)
1987 dhtlog_handle->insert_round (DHT_ROUND_GET, rounds_finished); 1982 dhtlog_handle->insert_round (DHT_ROUND_GET, rounds_finished);
1988 1983
1989 die_task 1984 die_task =
1990 =
1991 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_add 1985 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_add
1992 (GNUNET_TIME_relative_add 1986 (GNUNET_TIME_relative_add
1993 (GNUNET_TIME_relative_multiply 1987 (GNUNET_TIME_relative_multiply
@@ -2004,8 +1998,7 @@ get_stop_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2004 { 1998 {
2005 if (dhtlog_handle != NULL) 1999 if (dhtlog_handle != NULL)
2006 dhtlog_handle->insert_round (DHT_ROUND_NORMAL, rounds_finished); 2000 dhtlog_handle->insert_round (DHT_ROUND_NORMAL, rounds_finished);
2007 die_task 2001 die_task =
2008 =
2009 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_add 2002 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_add
2010 (GNUNET_TIME_relative_multiply 2003 (GNUNET_TIME_relative_multiply
2011 (GNUNET_TIME_UNIT_SECONDS, 2004 (GNUNET_TIME_UNIT_SECONDS,
@@ -2133,21 +2126,18 @@ do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2133 2126
2134 cumulative_num_gets++; 2127 cumulative_num_gets++;
2135 /* Insert the data at the first peer */ 2128 /* Insert the data at the first peer */
2136 test_get->get_handle = GNUNET_DHT_get_start (test_get->dht_handle, get_delay, 2129 test_get->get_handle =
2137 GNUNET_BLOCK_TYPE_TEST, 2130 GNUNET_DHT_get_start (test_get->dht_handle, get_delay,
2138 &known_keys[test_get->uid], 2131 GNUNET_BLOCK_TYPE_TEST, &known_keys[test_get->uid],
2139 get_replication, 2132 get_replication, GNUNET_DHT_RO_NONE, NULL, 0, NULL,
2140 GNUNET_DHT_RO_NONE, NULL, 0, 2133 0, &get_result_iterator, test_get);
2141 NULL, 0, &get_result_iterator,
2142 test_get);
2143 2134
2144#if VERBOSE > 1 2135#if VERBOSE > 1
2145 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting get for uid %u from peer %s\n", 2136 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting get for uid %u from peer %s\n",
2146 test_get->uid, test_get->daemon->shortname); 2137 test_get->uid, test_get->daemon->shortname);
2147#endif 2138#endif
2148 test_get->disconnect_task = GNUNET_SCHEDULER_add_delayed (get_timeout, 2139 test_get->disconnect_task =
2149 &get_stop_task, 2140 GNUNET_SCHEDULER_add_delayed (get_timeout, &get_stop_task, test_get);
2150 test_get);
2151 2141
2152 /* Schedule the next request in the linked list of get requests */ 2142 /* Schedule the next request in the linked list of get requests */
2153 GNUNET_SCHEDULER_add_now (&do_get, test_get->next); 2143 GNUNET_SCHEDULER_add_now (&do_get, test_get->next);
@@ -2171,14 +2161,14 @@ put_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2171 2161
2172 /* Reset the daemon (which peer to insert at) for later put request iterations */ 2162 /* Reset the daemon (which peer to insert at) for later put request iterations */
2173 if (replicate_same == GNUNET_NO) 2163 if (replicate_same == GNUNET_NO)
2174 test_put->daemon 2164 test_put->daemon =
2175 = GNUNET_TESTING_daemon_get (pg, 2165 GNUNET_TESTING_daemon_get (pg,
2176 GNUNET_CRYPTO_random_u32 2166 GNUNET_CRYPTO_random_u32
2177 (GNUNET_CRYPTO_QUALITY_WEAK, num_peers)); 2167 (GNUNET_CRYPTO_QUALITY_WEAK, num_peers));
2178 2168
2179 GNUNET_SCHEDULER_cancel (test_put->disconnect_task); 2169 GNUNET_SCHEDULER_cancel (test_put->disconnect_task);
2180 test_put->disconnect_task = GNUNET_SCHEDULER_add_now (&put_disconnect_task, 2170 test_put->disconnect_task =
2181 test_put); 2171 GNUNET_SCHEDULER_add_now (&put_disconnect_task, test_put);
2182 if (GNUNET_YES == update_meter (put_meter)) 2172 if (GNUNET_YES == update_meter (put_meter))
2183 { 2173 {
2184 GNUNET_assert (outstanding_puts == 0); 2174 GNUNET_assert (outstanding_puts == 0);
@@ -2190,8 +2180,7 @@ put_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2190 topo_ctx->cls = all_gets; 2180 topo_ctx->cls = all_gets;
2191 topo_ctx->timeout = DEFAULT_GET_TIMEOUT; 2181 topo_ctx->timeout = DEFAULT_GET_TIMEOUT;
2192 topo_ctx->peers_seen = GNUNET_CONTAINER_multihashmap_create (num_peers); 2182 topo_ctx->peers_seen = GNUNET_CONTAINER_multihashmap_create (num_peers);
2193 die_task 2183 die_task =
2194 =
2195 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_add 2184 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_add
2196 (GNUNET_TIME_relative_add 2185 (GNUNET_TIME_relative_add
2197 (DEFAULT_GET_TIMEOUT, all_get_timeout), 2186 (DEFAULT_GET_TIMEOUT, all_get_timeout),
@@ -2203,8 +2192,7 @@ put_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2203 else 2192 else
2204 { 2193 {
2205 fprintf (stderr, "Scheduling die task (put finished)\n"); 2194 fprintf (stderr, "Scheduling die task (put finished)\n");
2206 die_task 2195 die_task =
2207 =
2208 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_add 2196 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_add
2209 (DEFAULT_GET_TIMEOUT, all_get_timeout), 2197 (DEFAULT_GET_TIMEOUT, all_get_timeout),
2210 &end_badly, 2198 &end_badly,
@@ -2240,8 +2228,9 @@ do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2240 2228
2241 for (i = 0; i < sizeof (data); i++) 2229 for (i = 0; i < sizeof (data); i++)
2242 { 2230 {
2243 memset (&data[i], GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 2231 memset (&data[i],
2244 UINT32_MAX), 1); 2232 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX),
2233 1);
2245 } 2234 }
2246 2235
2247 if (outstanding_puts > max_outstanding_puts) 2236 if (outstanding_puts > max_outstanding_puts)
@@ -2264,23 +2253,23 @@ do_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2264 put_replication, GNUNET_DHT_RO_NONE, GNUNET_BLOCK_TYPE_TEST, 2253 put_replication, GNUNET_DHT_RO_NONE, GNUNET_BLOCK_TYPE_TEST,
2265 sizeof (data), data, GNUNET_TIME_UNIT_FOREVER_ABS, put_delay, 2254 sizeof (data), data, GNUNET_TIME_UNIT_FOREVER_ABS, put_delay,
2266 &put_finished, test_put); 2255 &put_finished, test_put);
2267 test_put->disconnect_task 2256 test_put->disconnect_task =
2268 = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_get_forever (), 2257 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_get_forever (),
2269 &put_disconnect_task, test_put); 2258 &put_disconnect_task, test_put);
2270 rand = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 2); 2259 rand = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 2);
2271 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 2260 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
2272 (GNUNET_TIME_UNIT_SECONDS, rand), &do_put, 2261 (GNUNET_TIME_UNIT_SECONDS, rand), &do_put,
2273 test_put->next); 2262 test_put->next);
2274} 2263}
2275 2264
2276static void 2265static void schedule_find_peer_requests (void *cls,
2277schedule_find_peer_requests (void *cls, 2266 const struct
2278 const struct GNUNET_SCHEDULER_TaskContext *tc); 2267 GNUNET_SCHEDULER_TaskContext *tc);
2279 2268
2280#if HAVE_MALICIOUS 2269#if HAVE_MALICIOUS
2281static void 2270static void setup_malicious_peers (void *cls,
2282setup_malicious_peers (void *cls, 2271 const struct GNUNET_SCHEDULER_TaskContext
2283 const struct GNUNET_SCHEDULER_TaskContext *tc); 2272 *tc);
2284#endif 2273#endif
2285 2274
2286/** 2275/**
@@ -2325,18 +2314,17 @@ count_peers_cb (void *cls, const struct GNUNET_PeerIdentity *first,
2325 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 2314 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
2326 "Peer count finished (%u connections), %u new peers, connection estimate %u (target %u)\n", 2315 "Peer count finished (%u connections), %u new peers, connection estimate %u (target %u)\n",
2327 find_peer_context->current_peers, 2316 find_peer_context->current_peers,
2328 find_peer_context->current_peers 2317 find_peer_context->current_peers -
2329 - find_peer_context->previous_peers, 2318 find_peer_context->previous_peers,
2330 connection_estimate (num_peers, DEFAULT_BUCKET_SIZE), 2319 connection_estimate (num_peers, DEFAULT_BUCKET_SIZE),
2331 target_total_connections); 2320 target_total_connections);
2332 2321
2333 if ((find_peer_context->last_sent < 8) 2322 if ((find_peer_context->last_sent < 8) ||
2334 || ((find_peer_context->current_peers < 2 2323 ((find_peer_context->current_peers <
2335 * connection_estimate (num_peers, DEFAULT_BUCKET_SIZE)) 2324 2 * connection_estimate (num_peers, DEFAULT_BUCKET_SIZE)) &&
2336 && 2325 (GNUNET_TIME_absolute_get_remaining (find_peer_context->endtime).
2337 (GNUNET_TIME_absolute_get_remaining 2326 rel_value > 0) &&
2338 (find_peer_context->endtime).rel_value > 0) && 2327 (find_peer_context->current_peers < target_total_connections)))
2339 (find_peer_context->current_peers < target_total_connections)))
2340 { 2328 {
2341 GNUNET_SCHEDULER_add_now (&schedule_find_peer_requests, 2329 GNUNET_SCHEDULER_add_now (&schedule_find_peer_requests,
2342 find_peer_context); 2330 find_peer_context);
@@ -2381,8 +2369,8 @@ schedule_find_peer_requests (void *cls,
2381 if (find_peer_ctx->previous_peers == 0) /* First time, go slowly */ 2369 if (find_peer_ctx->previous_peers == 0) /* First time, go slowly */
2382 find_peer_ctx->total = 1; 2370 find_peer_ctx->total = 1;
2383 else if (find_peer_ctx->current_peers - find_peer_ctx->previous_peers > MAX_FIND_PEER_CUTOFF) /* Found LOTS of peers, still go slowly */ 2371 else if (find_peer_ctx->current_peers - find_peer_ctx->previous_peers > MAX_FIND_PEER_CUTOFF) /* Found LOTS of peers, still go slowly */
2384 find_peer_ctx->total = find_peer_ctx->last_sent - (find_peer_ctx->last_sent 2372 find_peer_ctx->total =
2385 / 8); 2373 find_peer_ctx->last_sent - (find_peer_ctx->last_sent / 8);
2386 else 2374 else
2387 find_peer_ctx->total = find_peer_ctx->last_sent * 2; 2375 find_peer_ctx->total = find_peer_ctx->last_sent * 2;
2388 2376
@@ -2397,8 +2385,8 @@ schedule_find_peer_requests (void *cls,
2397 "Sending %u find peer messages (goal at least %u connections)\n", 2385 "Sending %u find peer messages (goal at least %u connections)\n",
2398 find_peer_ctx->total, target_total_connections); 2386 find_peer_ctx->total, target_total_connections);
2399 2387
2400 find_peer_offset = GNUNET_TIME_relative_divide (find_peer_delay, 2388 find_peer_offset =
2401 find_peer_ctx->total); 2389 GNUNET_TIME_relative_divide (find_peer_delay, find_peer_ctx->total);
2402 for (i = 0; i < find_peer_ctx->total; i++) 2390 for (i = 0; i < find_peer_ctx->total; i++)
2403 { 2391 {
2404 test_find_peer = GNUNET_malloc (sizeof (struct TestFindPeer)); 2392 test_find_peer = GNUNET_malloc (sizeof (struct TestFindPeer));
@@ -2418,9 +2406,10 @@ schedule_find_peer_requests (void *cls,
2418 * will be between 0 - 10, second between 10 - 20, etc. 2406 * will be between 0 - 10, second between 10 - 20, etc.
2419 */ 2407 */
2420 random = (num_peers / find_peer_ctx->total) * i; 2408 random = (num_peers / find_peer_ctx->total) * i;
2421 random = random 2409 random =
2422 + GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 2410 random + GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
2423 (num_peers / find_peer_ctx->total)); 2411 (num_peers /
2412 find_peer_ctx->total));
2424 if (random >= num_peers) 2413 if (random >= num_peers)
2425 { 2414 {
2426 random = random - num_peers; 2415 random = random - num_peers;
@@ -2432,12 +2421,14 @@ schedule_find_peer_requests (void *cls,
2432 } 2421 }
2433 else /* If we have sent requests, choose peers with a low number of connections to send requests from */ 2422 else /* If we have sent requests, choose peers with a low number of connections to send requests from */
2434 { 2423 {
2435 peer_count 2424 peer_count =
2436 = GNUNET_CONTAINER_heap_remove_root (find_peer_ctx->peer_min_heap); 2425 GNUNET_CONTAINER_heap_remove_root (find_peer_ctx->peer_min_heap);
2437 GNUNET_assert (GNUNET_YES == 2426 GNUNET_assert (GNUNET_YES ==
2438 GNUNET_CONTAINER_multihashmap_remove 2427 GNUNET_CONTAINER_multihashmap_remove (find_peer_ctx->
2439 (find_peer_ctx->peer_hash, &peer_count->peer_id.hashPubKey, 2428 peer_hash,
2440 peer_count)); 2429 &peer_count->peer_id.
2430 hashPubKey,
2431 peer_count));
2441 test_find_peer->daemon = 2432 test_find_peer->daemon =
2442 GNUNET_TESTING_daemon_get_by_id (pg, &peer_count->peer_id); 2433 GNUNET_TESTING_daemon_get_by_id (pg, &peer_count->peer_id);
2443 GNUNET_assert (test_find_peer->daemon != NULL); 2434 GNUNET_assert (test_find_peer->daemon != NULL);
@@ -2449,12 +2440,12 @@ schedule_find_peer_requests (void *cls,
2449 &send_find_peer_request, test_find_peer); 2440 &send_find_peer_request, test_find_peer);
2450 } 2441 }
2451 2442
2452 if ((find_peer_ctx->peer_hash == NULL) && (find_peer_ctx->peer_min_heap 2443 if ((find_peer_ctx->peer_hash == NULL) &&
2453 == NULL)) 2444 (find_peer_ctx->peer_min_heap == NULL))
2454 { 2445 {
2455 find_peer_ctx->peer_hash = GNUNET_CONTAINER_multihashmap_create (num_peers); 2446 find_peer_ctx->peer_hash = GNUNET_CONTAINER_multihashmap_create (num_peers);
2456 find_peer_ctx->peer_min_heap 2447 find_peer_ctx->peer_min_heap =
2457 = GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN); 2448 GNUNET_CONTAINER_heap_create (GNUNET_CONTAINER_HEAP_ORDER_MIN);
2458 } 2449 }
2459 else 2450 else
2460 { 2451 {
@@ -2521,20 +2512,20 @@ setup_puts_and_gets (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2521 GNUNET_CRYPTO_hash_matching_bits (&known_keys[i], 2512 GNUNET_CRYPTO_hash_matching_bits (&known_keys[i],
2522 &sybil_target)); 2513 &sybil_target));
2523 } 2514 }
2524 temp_peer = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 2515 temp_peer =
2525 num_peers); 2516 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, num_peers);
2526 test_put->daemon = GNUNET_TESTING_daemon_get (pg, temp_peer); 2517 test_put->daemon = GNUNET_TESTING_daemon_get (pg, temp_peer);
2527 /* Don't start PUTs at malicious peers! */ 2518 /* Don't start PUTs at malicious peers! */
2528 if (malicious_bloom != NULL) 2519 if (malicious_bloom != NULL)
2529 { 2520 {
2530 count = 0; 2521 count = 0;
2531 hash_from_uid (temp_peer, &uid_hash); 2522 hash_from_uid (temp_peer, &uid_hash);
2532 while ((GNUNET_YES 2523 while ((GNUNET_YES ==
2533 == GNUNET_CONTAINER_bloomfilter_test (malicious_bloom, &uid_hash)) 2524 GNUNET_CONTAINER_bloomfilter_test (malicious_bloom, &uid_hash)) &&
2534 && (count < num_peers)) 2525 (count < num_peers))
2535 { 2526 {
2536 temp_peer = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 2527 temp_peer =
2537 num_peers); 2528 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, num_peers);
2538 hash_from_uid (temp_peer, &uid_hash); 2529 hash_from_uid (temp_peer, &uid_hash);
2539 test_put->daemon = GNUNET_TESTING_daemon_get (pg, temp_peer); 2530 test_put->daemon = GNUNET_TESTING_daemon_get (pg, temp_peer);
2540 count++; 2531 count++;
@@ -2551,28 +2542,28 @@ setup_puts_and_gets (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2551 for (i = 0; i < num_gets; i++) 2542 for (i = 0; i < num_gets; i++)
2552 { 2543 {
2553 test_get = GNUNET_malloc (sizeof (struct TestGetContext)); 2544 test_get = GNUNET_malloc (sizeof (struct TestGetContext));
2554 test_get->uid = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 2545 test_get->uid =
2555 num_puts); 2546 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, num_puts);
2556#if REMEMBER 2547#if REMEMBER
2557 while (remember[test_get->uid][temp_daemon] == 1) 2548 while (remember[test_get->uid][temp_daemon] == 1)
2558 temp_daemon = 2549 temp_daemon =
2559 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, num_peers); 2550 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, num_peers);
2560 remember[test_get->uid][temp_daemon] = 1; 2551 remember[test_get->uid][temp_daemon] = 1;
2561#endif 2552#endif
2562 temp_peer = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 2553 temp_peer =
2563 num_peers); 2554 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, num_peers);
2564 test_get->daemon = GNUNET_TESTING_daemon_get (pg, temp_peer); 2555 test_get->daemon = GNUNET_TESTING_daemon_get (pg, temp_peer);
2565 /* Don't start GETs at malicious peers! */ 2556 /* Don't start GETs at malicious peers! */
2566 if (malicious_bloom != NULL) 2557 if (malicious_bloom != NULL)
2567 { 2558 {
2568 hash_from_uid (temp_peer, &uid_hash); 2559 hash_from_uid (temp_peer, &uid_hash);
2569 count = 0; 2560 count = 0;
2570 while ((GNUNET_YES 2561 while ((GNUNET_YES ==
2571 == GNUNET_CONTAINER_bloomfilter_test (malicious_bloom, &uid_hash)) 2562 GNUNET_CONTAINER_bloomfilter_test (malicious_bloom, &uid_hash)) &&
2572 && (count < num_peers)) 2563 (count < num_peers))
2573 { 2564 {
2574 temp_peer = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 2565 temp_peer =
2575 num_peers); 2566 GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, num_peers);
2576 hash_from_uid (temp_peer, &uid_hash); 2567 hash_from_uid (temp_peer, &uid_hash);
2577 test_get->daemon = GNUNET_TESTING_daemon_get (pg, temp_peer); 2568 test_get->daemon = GNUNET_TESTING_daemon_get (pg, temp_peer);
2578 count++; 2569 count++;
@@ -2586,8 +2577,7 @@ setup_puts_and_gets (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2586 } 2577 }
2587 2578
2588 /*GNUNET_SCHEDULER_cancel (die_task); */ 2579 /*GNUNET_SCHEDULER_cancel (die_task); */
2589 die_task 2580 die_task =
2590 =
2591 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 2581 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
2592 (GNUNET_TIME_UNIT_SECONDS, num_puts * 2), 2582 (GNUNET_TIME_UNIT_SECONDS, num_puts * 2),
2593 &end_badly, "from do puts"); 2583 &end_badly, "from do puts");
@@ -2660,8 +2650,7 @@ continue_puts_and_gets (void *cls,
2660 "Scheduling find peer requests during \"settle\" time.\n"); 2650 "Scheduling find peer requests during \"settle\" time.\n");
2661 find_peer_context = GNUNET_malloc (sizeof (struct FindPeerContext)); 2651 find_peer_context = GNUNET_malloc (sizeof (struct FindPeerContext));
2662 find_peer_context->count_peers_cb = &count_peers_cb; 2652 find_peer_context->count_peers_cb = &count_peers_cb;
2663 find_peer_context->endtime 2653 find_peer_context->endtime =
2664 =
2665 GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply 2654 GNUNET_TIME_relative_to_absolute (GNUNET_TIME_relative_multiply
2666 (GNUNET_TIME_UNIT_SECONDS, 2655 (GNUNET_TIME_UNIT_SECONDS,
2667 settle_time)); 2656 settle_time));
@@ -2690,8 +2679,8 @@ malicious_disconnect_task (void *cls,
2690 ctx->dht_handle = NULL; 2679 ctx->dht_handle = NULL;
2691 GNUNET_free (ctx); 2680 GNUNET_free (ctx);
2692 2681
2693 if (malicious_completed == malicious_getters + malicious_putters 2682 if (malicious_completed ==
2694 + malicious_droppers) 2683 malicious_getters + malicious_putters + malicious_droppers)
2695 { 2684 {
2696 fprintf (stderr, "Finished setting all malicious peers up!\n"); 2685 fprintf (stderr, "Finished setting all malicious peers up!\n");
2697 } 2686 }
@@ -2757,9 +2746,9 @@ set_malicious (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2757 break; 2746 break;
2758 } 2747 }
2759 2748
2760 ctx->disconnect_task 2749 ctx->disconnect_task =
2761 = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 2750 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
2762 &malicious_disconnect_task, ctx); 2751 &malicious_disconnect_task, ctx);
2763} 2752}
2764 2753
2765/** 2754/**
@@ -2890,16 +2879,17 @@ setup_malicious_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2890 2879
2891#if ONLY_TESTING 2880#if ONLY_TESTING
2892/* Forward declaration */ 2881/* Forward declaration */
2893static void 2882static void topology_callback (void *cls,
2894topology_callback (void *cls, 2883 const struct GNUNET_PeerIdentity *first,
2895 const struct GNUNET_PeerIdentity *first, 2884 const struct GNUNET_PeerIdentity *second,
2896 const struct GNUNET_PeerIdentity *second, 2885 uint32_t distance,
2897 uint32_t distance, 2886 const struct GNUNET_CONFIGURATION_Handle
2898 const struct GNUNET_CONFIGURATION_Handle *first_cfg, 2887 *first_cfg,
2899 const struct GNUNET_CONFIGURATION_Handle *second_cfg, 2888 const struct GNUNET_CONFIGURATION_Handle
2900 struct GNUNET_TESTING_Daemon *first_daemon, 2889 *second_cfg,
2901 struct GNUNET_TESTING_Daemon *second_daemon, 2890 struct GNUNET_TESTING_Daemon *first_daemon,
2902 const char *emsg); 2891 struct GNUNET_TESTING_Daemon *second_daemon,
2892 const char *emsg);
2903 2893
2904/** 2894/**
2905 * Retry connecting two specific peers until they connect, 2895 * Retry connecting two specific peers until they connect,
@@ -2920,8 +2910,7 @@ repeat_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
2920 repeat_connect_peer2->cfgfile); 2910 repeat_connect_peer2->cfgfile);
2921 2911
2922 repeat_connect_task = GNUNET_SCHEDULER_NO_TASK; 2912 repeat_connect_task = GNUNET_SCHEDULER_NO_TASK;
2923 GNUNET_TESTING_daemons_connect (repeat_connect_peer1, 2913 GNUNET_TESTING_daemons_connect (repeat_connect_peer1, repeat_connect_peer2,
2924 repeat_connect_peer2,
2925 GNUNET_TIME_relative_multiply 2914 GNUNET_TIME_relative_multiply
2926 (GNUNET_TIME_UNIT_SECONDS, 60), 2, 2915 (GNUNET_TIME_UNIT_SECONDS, 60), 2,
2927 &topology_callback, NULL); 2916 &topology_callback, NULL);
@@ -2989,9 +2978,9 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
2989 } 2978 }
2990#endif 2979#endif
2991 2980
2992 if (GNUNET_TIME_absolute_get_difference (connect_last_time, 2981 if (GNUNET_TIME_absolute_get_difference
2993 GNUNET_TIME_absolute_get 2982 (connect_last_time,
2994 ()).rel_value > 2983 GNUNET_TIME_absolute_get ()).rel_value >
2995 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2984 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
2996 CONN_UPDATE_DURATION).rel_value) 2985 CONN_UPDATE_DURATION).rel_value)
2997 { 2986 {
@@ -3002,19 +2991,19 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
3002 new_failed_connections = failed_connections - previous_failed_connections; 2991 new_failed_connections = failed_connections - previous_failed_connections;
3003 2992
3004 /* Get duration in seconds */ 2993 /* Get duration in seconds */
3005 duration 2994 duration =
3006 = GNUNET_TIME_absolute_get_difference (connect_last_time, 2995 GNUNET_TIME_absolute_get_difference (connect_last_time,
3007 GNUNET_TIME_absolute_get 2996 GNUNET_TIME_absolute_get ()).
3008 ()).rel_value / 1000; 2997 rel_value / 1000;
3009 total_duration = 2998 total_duration =
3010 GNUNET_TIME_absolute_get_difference (connect_start_time, 2999 GNUNET_TIME_absolute_get_difference (connect_start_time,
3011 GNUNET_TIME_absolute_get 3000 GNUNET_TIME_absolute_get ()).
3012 ()).rel_value / 1000; 3001 rel_value / 1000;
3013 3002
3014 failed_conns_per_sec_recent = (double) new_failed_connections 3003 failed_conns_per_sec_recent =
3015 / (double) duration; 3004 (double) new_failed_connections / (double) duration;
3016 failed_conns_per_sec_total = (double) failed_connections 3005 failed_conns_per_sec_total =
3017 / (double) total_duration; 3006 (double) failed_connections / (double) total_duration;
3018 conns_per_sec_recent = (double) new_connections / (double) duration; 3007 conns_per_sec_recent = (double) new_connections / (double) duration;
3019 conns_per_sec_total = (double) total_connections / (double) total_duration; 3008 conns_per_sec_total = (double) total_connections / (double) total_duration;
3020 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 3009 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -3025,14 +3014,13 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
3025 previous_connections = total_connections; 3014 previous_connections = total_connections;
3026 previous_failed_connections = failed_connections; 3015 previous_failed_connections = failed_connections;
3027 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 3016 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
3028 "have %llu total_connections, %llu failed\n", 3017 "have %llu total_connections, %llu failed\n", total_connections,
3029 total_connections, failed_connections); 3018 failed_connections);
3030#if ONLY_TESTING 3019#if ONLY_TESTING
3031 /* These conditions likely mean we've entered the death spiral of doom */ 3020 /* These conditions likely mean we've entered the death spiral of doom */
3032 if ((total_connections > 20000) && 3021 if ((total_connections > 20000) && (conns_per_sec_recent < 5.0) &&
3033 (conns_per_sec_recent < 5.0) && 3022 (conns_per_sec_total > 10.0) && (emsg != NULL) &&
3034 (conns_per_sec_total > 10.0) && 3023 (repeat_connect_mode == GNUNET_NO))
3035 (emsg != NULL) && (repeat_connect_mode == GNUNET_NO))
3036 { 3024 {
3037 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 3025 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
3038 "Entering repeat connection attempt mode!\n"); 3026 "Entering repeat connection attempt mode!\n");
@@ -3096,10 +3084,10 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
3096 dhtlog_handle->insert_topology (expected_connections); 3084 dhtlog_handle->insert_topology (expected_connections);
3097 } 3085 }
3098 3086
3099 total_duration 3087 total_duration =
3100 = GNUNET_TIME_absolute_get_difference (connect_start_time, 3088 GNUNET_TIME_absolute_get_difference (connect_start_time,
3101 GNUNET_TIME_absolute_get 3089 GNUNET_TIME_absolute_get ()).
3102 ()).rel_value / 1000; 3090 rel_value / 1000;
3103 failed_conns_per_sec_total = 3091 failed_conns_per_sec_total =
3104 (long double) failed_connections / total_duration; 3092 (long double) failed_connections / total_duration;
3105 conns_per_sec_total = (long double) total_connections / total_duration; 3093 conns_per_sec_total = (long double) total_connections / total_duration;
@@ -3162,9 +3150,9 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first,
3162 else if (total_connections + failed_connections == expected_connections) 3150 else if (total_connections + failed_connections == expected_connections)
3163 { 3151 {
3164 GNUNET_SCHEDULER_cancel (die_task); 3152 GNUNET_SCHEDULER_cancel (die_task);
3165 die_task 3153 die_task =
3166 = GNUNET_SCHEDULER_add_now (&end_badly, 3154 GNUNET_SCHEDULER_add_now (&end_badly,
3167 "from topology_callback (too many failed connections)"); 3155 "from topology_callback (too many failed connections)");
3168 } 3156 }
3169} 3157}
3170 3158
@@ -3200,8 +3188,7 @@ peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id,
3200 3188
3201 GNUNET_asprintf (&revision_str, "%llu", revision); 3189 GNUNET_asprintf (&revision_str, "%llu", revision);
3202 if (GNUNET_YES == insert_gauger_data) 3190 if (GNUNET_YES == insert_gauger_data)
3203 GAUGER_ID ("DHT_TESTING", 3191 GAUGER_ID ("DHT_TESTING", "peer_startup_time",
3204 "peer_startup_time",
3205 GNUNET_TIME_absolute_get_duration (peer_start_time).rel_value / 3192 GNUNET_TIME_absolute_get_duration (peer_start_time).rel_value /
3206 (double) num_peers, "ms/peer", revision_str); 3193 (double) num_peers, "ms/peer", revision_str);
3207 GNUNET_free (revision_str); 3194 GNUNET_free (revision_str);
@@ -3210,28 +3197,26 @@ peers_started_callback (void *cls, const struct GNUNET_PeerIdentity *id,
3210 if ((pg != NULL) && (peers_left == 0)) 3197 if ((pg != NULL) && (peers_left == 0))
3211 { 3198 {
3212 connect_start_time = GNUNET_TIME_absolute_get (); 3199 connect_start_time = GNUNET_TIME_absolute_get ();
3213 expected_connections 3200 expected_connections =
3214 = GNUNET_TESTING_connect_topology (pg, 3201 GNUNET_TESTING_connect_topology (pg, connect_topology,
3215 connect_topology, 3202 connect_topology_option,
3216 connect_topology_option, 3203 connect_topology_option_modifier,
3217 connect_topology_option_modifier, 3204 connect_timeout, connect_attempts,
3218 connect_timeout, 3205 NULL, NULL);
3219 connect_attempts, NULL, NULL); 3206
3220 3207 peer_connect_meter =
3221 peer_connect_meter = create_meter (expected_connections, 3208 create_meter (expected_connections, "Peer connection ", GNUNET_YES);
3222 "Peer connection ", GNUNET_YES);
3223 fprintf (stderr, "Have %d expected connections\n", expected_connections); 3209 fprintf (stderr, "Have %d expected connections\n", expected_connections);
3224 } 3210 }
3225 3211
3226 if (expected_connections == 0) 3212 if (expected_connections == 0)
3227 { 3213 {
3228 die_task 3214 die_task =
3229 = GNUNET_SCHEDULER_add_now (&end_badly, 3215 GNUNET_SCHEDULER_add_now (&end_badly,
3230 "from connect topology (bad return)"); 3216 "from connect topology (bad return)");
3231 } 3217 }
3232 3218
3233 die_task 3219 die_task =
3234 =
3235 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 3220 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
3236 (GNUNET_TIME_UNIT_SECONDS, 3221 (GNUNET_TIME_UNIT_SECONDS,
3237 DEFAULT_CONNECT_TIMEOUT * 3222 DEFAULT_CONNECT_TIMEOUT *
@@ -3248,9 +3233,9 @@ create_topology ()
3248 unsigned int create_expected_connections; 3233 unsigned int create_expected_connections;
3249 3234
3250 peers_left = num_peers; /* Reset counter */ 3235 peers_left = num_peers; /* Reset counter */
3251 create_expected_connections 3236 create_expected_connections =
3252 = GNUNET_TESTING_create_topology (pg, topology, blacklist_topology, 3237 GNUNET_TESTING_create_topology (pg, topology, blacklist_topology,
3253 blacklist_transports); 3238 blacklist_transports);
3254 if (create_expected_connections > 0) 3239 if (create_expected_connections > 0)
3255 { 3240 {
3256 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 3241 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -3262,13 +3247,13 @@ create_topology ()
3262 else 3247 else
3263 { 3248 {
3264 GNUNET_SCHEDULER_cancel (die_task); 3249 GNUNET_SCHEDULER_cancel (die_task);
3265 die_task = GNUNET_SCHEDULER_add_now (&end_badly, 3250 die_task =
3266 "from create topology (bad return)"); 3251 GNUNET_SCHEDULER_add_now (&end_badly,
3252 "from create topology (bad return)");
3267 } 3253 }
3268 GNUNET_free_non_null (blacklist_transports); 3254 GNUNET_free_non_null (blacklist_transports);
3269 GNUNET_SCHEDULER_cancel (die_task); 3255 GNUNET_SCHEDULER_cancel (die_task);
3270 die_task 3256 die_task =
3271 =
3272 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 3257 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
3273 (seconds_per_peer_start, num_peers), 3258 (seconds_per_peer_start, num_peers),
3274 &end_badly, 3259 &end_badly,
@@ -3297,8 +3282,8 @@ hostkey_callback (void *cls, const struct GNUNET_PeerIdentity *id,
3297 3282
3298#if VERBOSE > 1 3283#if VERBOSE > 1
3299 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3284 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3300 "Hostkey (%d/%d) created for peer `%s'\n", 3285 "Hostkey (%d/%d) created for peer `%s'\n", num_peers - peers_left,
3301 num_peers - peers_left, num_peers, GNUNET_i2s (id)); 3286 num_peers, GNUNET_i2s (id));
3302#endif 3287#endif
3303 3288
3304 peers_left--; 3289 peers_left--;
@@ -3310,22 +3295,18 @@ hostkey_callback (void *cls, const struct GNUNET_PeerIdentity *id,
3310 GNUNET_asprintf (&revision_str, "%llu", revision); 3295 GNUNET_asprintf (&revision_str, "%llu", revision);
3311 if (GNUNET_YES == insert_gauger_data) 3296 if (GNUNET_YES == insert_gauger_data)
3312 { 3297 {
3313 if (GNUNET_YES == GNUNET_CONFIGURATION_have_value (config, "TESTING", 3298 if (GNUNET_YES ==
3314 "HOSTKEYSFILE")) 3299 GNUNET_CONFIGURATION_have_value (config, "TESTING", "HOSTKEYSFILE"))
3315 { 3300 {
3316 GAUGER_ID ("DHT_TESTING", 3301 GAUGER_ID ("DHT_TESTING", "HOSTKEY_GENERATION",
3317 "HOSTKEY_GENERATION", 3302 GNUNET_TIME_absolute_get_duration (hostkey_start_time).
3318 GNUNET_TIME_absolute_get_duration 3303 rel_value / (double) num_peers, "ms/hostkey", revision_str);
3319 (hostkey_start_time).rel_value / (double) num_peers,
3320 "ms/hostkey", revision_str);
3321 } 3304 }
3322 else 3305 else
3323 { 3306 {
3324 GAUGER_ID ("DHT_TESTING", 3307 GAUGER_ID ("DHT_TESTING", "HOSTKEY_GENERATION_REAL",
3325 "HOSTKEY_GENERATION_REAL", 3308 GNUNET_TIME_absolute_get_duration (hostkey_start_time).
3326 GNUNET_TIME_absolute_get_duration 3309 rel_value / (double) num_peers, "ms/hostkey", revision_str);
3327 (hostkey_start_time).rel_value / (double) num_peers,
3328 "ms/hostkey", revision_str);
3329 } 3310 }
3330 } 3311 }
3331 3312
@@ -3334,9 +3315,9 @@ hostkey_callback (void *cls, const struct GNUNET_PeerIdentity *id,
3334 GNUNET_SCHEDULER_cancel (die_task); 3315 GNUNET_SCHEDULER_cancel (die_task);
3335 /* Set up task in case topology creation doesn't finish 3316 /* Set up task in case topology creation doesn't finish
3336 * within a reasonable amount of time */ 3317 * within a reasonable amount of time */
3337 die_task = GNUNET_SCHEDULER_add_delayed (DEFAULT_TOPOLOGY_TIMEOUT, 3318 die_task =
3338 &end_badly, 3319 GNUNET_SCHEDULER_add_delayed (DEFAULT_TOPOLOGY_TIMEOUT, &end_badly,
3339 "from create_topology"); 3320 "from create_topology");
3340 GNUNET_SCHEDULER_add_now (&create_topology, NULL); 3321 GNUNET_SCHEDULER_add_now (&create_topology, NULL);
3341 ok = 0; 3322 ok = 0;
3342 } 3323 }
@@ -3379,18 +3360,18 @@ run (void *cls, char *const *args, const char *cfgfile,
3379 rounds_finished = 0; 3360 rounds_finished = 0;
3380 memset (&trial_info, 0, sizeof (struct GNUNET_DHTLOG_TrialInfo)); 3361 memset (&trial_info, 0, sizeof (struct GNUNET_DHTLOG_TrialInfo));
3381 /* Get path from configuration file */ 3362 /* Get path from configuration file */
3382 if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_string (cfg, "paths", 3363 if (GNUNET_YES !=
3383 "servicehome", 3364 GNUNET_CONFIGURATION_get_value_string (cfg, "paths", "servicehome",
3384 &test_directory)) 3365 &test_directory))
3385 { 3366 {
3386 ok = 404; 3367 ok = 404;
3387 return; 3368 return;
3388 } 3369 }
3389 3370
3390 /* Get number of peers to start from configuration */ 3371 /* Get number of peers to start from configuration */
3391 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, "testing", 3372 if (GNUNET_SYSERR ==
3392 "num_peers", 3373 GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "num_peers",
3393 &num_peers)) 3374 &num_peers))
3394 { 3375 {
3395 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 3376 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
3396 "Number of peers must be specified in section %s option %s\n", 3377 "Number of peers must be specified in section %s option %s\n",
@@ -3398,11 +3379,12 @@ run (void *cls, char *const *args, const char *cfgfile,
3398 } 3379 }
3399 GNUNET_assert (num_peers > 0 && num_peers < ULONG_MAX); 3380 GNUNET_assert (num_peers > 0 && num_peers < ULONG_MAX);
3400 3381
3401 if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (cfg, "testing", 3382 if (GNUNET_OK ==
3402 "connect_timeout", 3383 GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "connect_timeout",
3403 &temp_config_number)) 3384 &temp_config_number))
3404 connect_timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3385 connect_timeout =
3405 temp_config_number); 3386 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
3387 temp_config_number);
3406 else 3388 else
3407 { 3389 {
3408 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n", 3390 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
@@ -3410,28 +3392,29 @@ run (void *cls, char *const *args, const char *cfgfile,
3410 return; 3392 return;
3411 } 3393 }
3412 3394
3413 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, "testing", 3395 if (GNUNET_OK !=
3414 "connect_attempts", 3396 GNUNET_CONFIGURATION_get_value_number (cfg, "testing", "connect_attempts",
3415 &connect_attempts)) 3397 &connect_attempts))
3416 { 3398 {
3417 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n", 3399 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
3418 "testing", "connect_attempts"); 3400 "testing", "connect_attempts");
3419 return; 3401 return;
3420 } 3402 }
3421 3403
3422 if (GNUNET_OK 3404 if (GNUNET_OK !=
3423 != GNUNET_CONFIGURATION_get_value_number (cfg, "testing", 3405 GNUNET_CONFIGURATION_get_value_number (cfg, "testing",
3424 "max_outstanding_connections", 3406 "max_outstanding_connections",
3425 &max_outstanding_connections)) 3407 &max_outstanding_connections))
3426 { 3408 {
3427 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n", 3409 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
3428 "testing", "max_outstanding_connections"); 3410 "testing", "max_outstanding_connections");
3429 return; 3411 return;
3430 } 3412 }
3431 3413
3432 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, "testing", 3414 if (GNUNET_OK !=
3433 "max_concurrent_ssh", 3415 GNUNET_CONFIGURATION_get_value_number (cfg, "testing",
3434 &max_concurrent_ssh)) 3416 "max_concurrent_ssh",
3417 &max_concurrent_ssh))
3435 { 3418 {
3436 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n", 3419 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Must provide option %s:%s!\n",
3437 "testing", "max_concurrent_ssh"); 3420 "testing", "max_concurrent_ssh");
@@ -3441,18 +3424,19 @@ run (void *cls, char *const *args, const char *cfgfile,
3441 /** 3424 /**
3442 * Get DHT specific testing options. 3425 * Get DHT specific testing options.
3443 */ 3426 */
3444 if ((GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht_testing", 3427 if ((GNUNET_YES ==
3445 "mysql_logging")) 3428 GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht_testing",
3446 || (GNUNET_YES 3429 "mysql_logging")) ||
3447 == GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht_testing", 3430 (GNUNET_YES ==
3448 "mysql_logging_extended")) 3431 GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht_testing",
3449 || (GNUNET_YES 3432 "mysql_logging_extended")) ||
3450 == GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht_testing", 3433 (GNUNET_YES ==
3451 "mysql_logging_minimal"))) 3434 GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht_testing",
3435 "mysql_logging_minimal")))
3452 { 3436 {
3453 if (GNUNET_YES 3437 if (GNUNET_YES ==
3454 == GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht_testing", 3438 GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht_testing",
3455 "mysql_logging_minimal")) 3439 "mysql_logging_minimal"))
3456 dhtlog_minimal = GNUNET_YES; 3440 dhtlog_minimal = GNUNET_YES;
3457 3441
3458 dhtlog_handle = GNUNET_DHTLOG_connect (cfg); 3442 dhtlog_handle = GNUNET_DHTLOG_connect (cfg);
@@ -3465,8 +3449,8 @@ run (void *cls, char *const *args, const char *cfgfile,
3465 } 3449 }
3466 } 3450 }
3467 3451
3468 stop_closest = GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht", 3452 stop_closest =
3469 "stop_on_closest"); 3453 GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht", "stop_on_closest");
3470 if (stop_closest == GNUNET_SYSERR) 3454 if (stop_closest == GNUNET_SYSERR)
3471 stop_closest = GNUNET_NO; 3455 stop_closest = GNUNET_NO;
3472 3456
@@ -3474,21 +3458,21 @@ run (void *cls, char *const *args, const char *cfgfile,
3474 if (stop_found == GNUNET_SYSERR) 3458 if (stop_found == GNUNET_SYSERR)
3475 stop_found = GNUNET_NO; 3459 stop_found = GNUNET_NO;
3476 3460
3477 strict_kademlia = GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht", 3461 strict_kademlia =
3478 "strict_kademlia"); 3462 GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht", "strict_kademlia");
3479 if (strict_kademlia == GNUNET_SYSERR) 3463 if (strict_kademlia == GNUNET_SYSERR)
3480 strict_kademlia = GNUNET_NO; 3464 strict_kademlia = GNUNET_NO;
3481 3465
3482 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "dht_testing", 3466 if (GNUNET_OK !=
3483 "comment", 3467 GNUNET_CONFIGURATION_get_value_string (cfg, "dht_testing", "comment",
3484 &trialmessage)) 3468 &trialmessage))
3485 trialmessage = NULL; 3469 trialmessage = NULL;
3486 3470
3487 churn_data = NULL; 3471 churn_data = NULL;
3488 /** Check for a churn file to do churny simulation */ 3472 /** Check for a churn file to do churny simulation */
3489 if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, "dht_testing", 3473 if (GNUNET_OK ==
3490 "churn_file", 3474 GNUNET_CONFIGURATION_get_value_string (cfg, "dht_testing", "churn_file",
3491 &churn_filename)) 3475 &churn_filename))
3492 { 3476 {
3493 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Reading churn data from %s\n", 3477 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Reading churn data from %s\n",
3494 churn_filename); 3478 churn_filename);
@@ -3511,8 +3495,8 @@ run (void *cls, char *const *args, const char *cfgfile,
3511 3495
3512 churn_data = GNUNET_malloc_large (frstat.st_size); 3496 churn_data = GNUNET_malloc_large (frstat.st_size);
3513 GNUNET_assert (churn_data != NULL); 3497 GNUNET_assert (churn_data != NULL);
3514 if (frstat.st_size != GNUNET_DISK_fn_read (churn_filename, churn_data, 3498 if (frstat.st_size !=
3515 frstat.st_size)) 3499 GNUNET_DISK_fn_read (churn_filename, churn_data, frstat.st_size))
3516 { 3500 {
3517 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 3501 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
3518 "Could not read file %s specified for churn, ending test!", 3502 "Could not read file %s specified for churn, ending test!",
@@ -3551,10 +3535,10 @@ run (void *cls, char *const *args, const char *cfgfile,
3551 } 3535 }
3552 } 3536 }
3553 3537
3554 if (GNUNET_OK 3538 if (GNUNET_OK !=
3555 != GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 3539 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing",
3556 "churns_per_round", 3540 "churns_per_round",
3557 &churns_per_round)) 3541 &churns_per_round))
3558 { 3542 {
3559 churns_per_round = (unsigned long long) churn_rounds; 3543 churns_per_round = (unsigned long long) churn_rounds;
3560 } 3544 }
@@ -3570,8 +3554,7 @@ run (void *cls, char *const *args, const char *cfgfile,
3570 ret = sscanf (buf, "%u", &churn_array[line_number]); 3554 ret = sscanf (buf, "%u", &churn_array[line_number]);
3571 if (1 == ret) 3555 if (1 == ret)
3572 { 3556 {
3573 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 3557 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Read %u peers in round %u\n",
3574 "Read %u peers in round %u\n",
3575 churn_array[line_number], line_number); 3558 churn_array[line_number], line_number);
3576 line_number++; 3559 line_number++;
3577 } 3560 }
@@ -3591,9 +3574,9 @@ run (void *cls, char *const *args, const char *cfgfile,
3591 GNUNET_free_non_null (churn_data); 3574 GNUNET_free_non_null (churn_data);
3592 3575
3593 /* Check for a hostfile containing user@host:port triples */ 3576 /* Check for a hostfile containing user@host:port triples */
3594 if (GNUNET_OK 3577 if (GNUNET_OK !=
3595 != GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "hostfile", 3578 GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "hostfile",
3596 &hostfile)) 3579 &hostfile))
3597 hostfile = NULL; 3580 hostfile = NULL;
3598 3581
3599 hosts = NULL; 3582 hosts = NULL;
@@ -3602,8 +3585,9 @@ run (void *cls, char *const *args, const char *cfgfile,
3602 if (hostfile != NULL) 3585 if (hostfile != NULL)
3603 { 3586 {
3604 if (GNUNET_OK != GNUNET_DISK_file_test (hostfile)) 3587 if (GNUNET_OK != GNUNET_DISK_file_test (hostfile))
3605 GNUNET_DISK_fn_write (hostfile, NULL, 0, GNUNET_DISK_PERM_USER_READ 3588 GNUNET_DISK_fn_write (hostfile, NULL, 0,
3606 | GNUNET_DISK_PERM_USER_WRITE); 3589 GNUNET_DISK_PERM_USER_READ |
3590 GNUNET_DISK_PERM_USER_WRITE);
3607 if ((0 != STAT (hostfile, &frstat)) || (frstat.st_size == 0)) 3591 if ((0 != STAT (hostfile, &frstat)) || (frstat.st_size == 0))
3608 { 3592 {
3609 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 3593 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -3638,9 +3622,9 @@ run (void *cls, char *const *args, const char *cfgfile,
3638 { 3622 {
3639 data[count] = '\0'; 3623 data[count] = '\0';
3640 temphost = GNUNET_malloc (sizeof (struct GNUNET_TESTING_Host)); 3624 temphost = GNUNET_malloc (sizeof (struct GNUNET_TESTING_Host));
3641 ret = sscanf (buf, "%a[a-zA-Z0-9_]@%a[a-zA-Z0-9.]:%hd", 3625 ret =
3642 &temphost->username, &temphost->hostname, 3626 sscanf (buf, "%a[a-zA-Z0-9_]@%a[a-zA-Z0-9.]:%hd",
3643 &temphost->port); 3627 &temphost->username, &temphost->hostname, &temphost->port);
3644 if (3 == ret) 3628 if (3 == ret)
3645 { 3629 {
3646 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3630 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -3664,124 +3648,134 @@ run (void *cls, char *const *args, const char *cfgfile,
3664 } 3648 }
3665 } 3649 }
3666 GNUNET_free_non_null (data); 3650 GNUNET_free_non_null (data);
3667 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 3651 if (GNUNET_OK !=
3668 "malicious_getters", 3652 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing",
3669 &malicious_getters)) 3653 "malicious_getters",
3654 &malicious_getters))
3670 malicious_getters = 0; 3655 malicious_getters = 0;
3671 3656
3672 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 3657 if (GNUNET_OK !=
3673 "malicious_putters", 3658 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing",
3674 &malicious_putters)) 3659 "malicious_putters",
3660 &malicious_putters))
3675 malicious_putters = 0; 3661 malicious_putters = 0;
3676 3662
3677 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 3663 if (GNUNET_OK !=
3678 "malicious_droppers", 3664 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing",
3679 &malicious_droppers)) 3665 "malicious_droppers",
3666 &malicious_droppers))
3680 malicious_droppers = 0; 3667 malicious_droppers = 0;
3681 3668
3682 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 3669 if (GNUNET_OK !=
3683 "settle_time", 3670 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", "settle_time",
3684 &settle_time)) 3671 &settle_time))
3685 settle_time = 0; 3672 settle_time = 0;
3686 3673
3687 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, 3674 if (GNUNET_SYSERR ==
3688 "dht_testing", 3675 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", "num_puts",
3689 "num_puts", 3676 &num_puts))
3690 &num_puts))
3691 num_puts = num_peers; 3677 num_puts = num_peers;
3692 3678
3693 if (GNUNET_SYSERR 3679 if (GNUNET_SYSERR ==
3694 == GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 3680 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing",
3695 "put_replication", 3681 "put_replication",
3696 &put_replication)) 3682 &put_replication))
3697 put_replication = DEFAULT_PUT_REPLICATION; 3683 put_replication = DEFAULT_PUT_REPLICATION;
3698 3684
3699 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, 3685 if (GNUNET_SYSERR ==
3700 "dht_testing", 3686 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", "num_gets",
3701 "num_gets", 3687 &num_gets))
3702 &num_gets))
3703 num_gets = num_peers; 3688 num_gets = num_peers;
3704 3689
3705 if (GNUNET_SYSERR 3690 if (GNUNET_SYSERR ==
3706 == GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 3691 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing",
3707 "get_replication", 3692 "get_replication",
3708 &get_replication)) 3693 &get_replication))
3709 get_replication = DEFAULT_GET_REPLICATION; 3694 get_replication = DEFAULT_GET_REPLICATION;
3710 3695
3711 if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 3696 if (GNUNET_OK ==
3712 "find_peer_delay", 3697 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing",
3713 &temp_config_number)) 3698 "find_peer_delay",
3714 find_peer_delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3699 &temp_config_number))
3715 temp_config_number); 3700 find_peer_delay =
3701 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
3702 temp_config_number);
3716 else 3703 else
3717 find_peer_delay = DEFAULT_FIND_PEER_DELAY; 3704 find_peer_delay = DEFAULT_FIND_PEER_DELAY;
3718 3705
3719 if (GNUNET_OK 3706 if (GNUNET_OK ==
3720 == GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 3707 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing",
3721 "concurrent_find_peers", 3708 "concurrent_find_peers",
3722 &temp_config_number)) 3709 &temp_config_number))
3723 max_outstanding_find_peers = temp_config_number; 3710 max_outstanding_find_peers = temp_config_number;
3724 else 3711 else
3725 max_outstanding_find_peers = DEFAULT_MAX_OUTSTANDING_FIND_PEERS; 3712 max_outstanding_find_peers = DEFAULT_MAX_OUTSTANDING_FIND_PEERS;
3726 3713
3727 if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 3714 if (GNUNET_OK ==
3728 "get_timeout", 3715 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", "get_timeout",
3729 &temp_config_number)) 3716 &temp_config_number))
3730 get_timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3717 get_timeout =
3731 temp_config_number); 3718 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
3719 temp_config_number);
3732 else 3720 else
3733 get_timeout = DEFAULT_GET_TIMEOUT; 3721 get_timeout = DEFAULT_GET_TIMEOUT;
3734 3722
3735 if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 3723 if (GNUNET_OK ==
3736 "concurrent_puts", 3724 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing",
3737 &temp_config_number)) 3725 "concurrent_puts",
3726 &temp_config_number))
3738 max_outstanding_puts = temp_config_number; 3727 max_outstanding_puts = temp_config_number;
3739 else 3728 else
3740 max_outstanding_puts = DEFAULT_MAX_OUTSTANDING_PUTS; 3729 max_outstanding_puts = DEFAULT_MAX_OUTSTANDING_PUTS;
3741 3730
3742 if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 3731 if (GNUNET_OK ==
3743 "concurrent_gets", 3732 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing",
3744 &temp_config_number)) 3733 "concurrent_gets",
3734 &temp_config_number))
3745 max_outstanding_gets = temp_config_number; 3735 max_outstanding_gets = temp_config_number;
3746 else 3736 else
3747 max_outstanding_gets = DEFAULT_MAX_OUTSTANDING_GETS; 3737 max_outstanding_gets = DEFAULT_MAX_OUTSTANDING_GETS;
3748 3738
3749 if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 3739 if (GNUNET_OK ==
3750 "timeout", 3740 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", "timeout",
3751 &temp_config_number)) 3741 &temp_config_number))
3752 all_get_timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3742 all_get_timeout =
3753 temp_config_number); 3743 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
3744 temp_config_number);
3754 else 3745 else
3755 all_get_timeout.rel_value = get_timeout.rel_value * num_gets; 3746 all_get_timeout.rel_value = get_timeout.rel_value * num_gets;
3756 3747
3757 if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 3748 if (GNUNET_OK ==
3758 "get_delay", 3749 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", "get_delay",
3759 &temp_config_number)) 3750 &temp_config_number))
3760 get_delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3751 get_delay =
3761 temp_config_number); 3752 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
3753 temp_config_number);
3762 else 3754 else
3763 get_delay = DEFAULT_GET_DELAY; 3755 get_delay = DEFAULT_GET_DELAY;
3764 3756
3765 if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 3757 if (GNUNET_OK ==
3766 "put_delay", 3758 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", "put_delay",
3767 &temp_config_number)) 3759 &temp_config_number))
3768 put_delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3760 put_delay =
3769 temp_config_number); 3761 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
3762 temp_config_number);
3770 else 3763 else
3771 put_delay = DEFAULT_PUT_DELAY; 3764 put_delay = DEFAULT_PUT_DELAY;
3772 3765
3773 if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 3766 if (GNUNET_OK ==
3774 "peer_start_timeout", 3767 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing",
3775 &temp_config_number)) 3768 "peer_start_timeout",
3776 seconds_per_peer_start 3769 &temp_config_number))
3777 = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3770 seconds_per_peer_start =
3778 temp_config_number); 3771 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
3772 temp_config_number);
3779 else 3773 else
3780 seconds_per_peer_start = DEFAULT_SECONDS_PER_PEER_START; 3774 seconds_per_peer_start = DEFAULT_SECONDS_PER_PEER_START;
3781 3775
3782 if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 3776 if (GNUNET_OK ==
3783 "data_size", 3777 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", "data_size",
3784 &temp_config_number)) 3778 &temp_config_number))
3785 test_data_size = temp_config_number; 3779 test_data_size = temp_config_number;
3786 else 3780 else
3787 test_data_size = DEFAULT_TEST_DATA_SIZE; 3781 test_data_size = DEFAULT_TEST_DATA_SIZE;
@@ -3789,39 +3783,42 @@ run (void *cls, char *const *args, const char *cfgfile,
3789 /** 3783 /**
3790 * Get DHT testing related options. 3784 * Get DHT testing related options.
3791 */ 3785 */
3792 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg, "DHT_TESTING", 3786 if (GNUNET_YES ==
3793 "REPLICATE_SAME")) 3787 GNUNET_CONFIGURATION_get_value_yesno (cfg, "DHT_TESTING",
3788 "REPLICATE_SAME"))
3794 replicate_same = GNUNET_YES; 3789 replicate_same = GNUNET_YES;
3795 3790
3796 if (GNUNET_SYSERR 3791 if (GNUNET_SYSERR ==
3797 == GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 3792 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing",
3798 "target_completions", 3793 "target_completions",
3799 &target_completions)) 3794 &target_completions))
3800 target_completions = 0; /* Not required, on stack */ 3795 target_completions = 0; /* Not required, on stack */
3801 3796
3802 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg, "DHT_TESTING", 3797 if (GNUNET_YES ==
3803 "GET_FROM_SAME")) 3798 GNUNET_CONFIGURATION_get_value_yesno (cfg, "DHT_TESTING",
3799 "GET_FROM_SAME"))
3804 get_from_same = GNUNET_YES; 3800 get_from_same = GNUNET_YES;
3805 3801
3806 if (GNUNET_NO 3802 if (GNUNET_NO ==
3807 == GNUNET_CONFIGURATION_get_value_time (cfg, "DHT_TESTING", 3803 GNUNET_CONFIGURATION_get_value_time (cfg, "DHT_TESTING",
3808 "MALICIOUS_GET_FREQUENCY", 3804 "MALICIOUS_GET_FREQUENCY",
3809 &malicious_get_frequency)) 3805 &malicious_get_frequency))
3810 malicious_get_frequency = DEFAULT_MALICIOUS_GET_FREQUENCY; 3806 malicious_get_frequency = DEFAULT_MALICIOUS_GET_FREQUENCY;
3811 3807
3812 if (GNUNET_NO 3808 if (GNUNET_NO ==
3813 == GNUNET_CONFIGURATION_get_value_time (cfg, "DHT_TESTING", 3809 GNUNET_CONFIGURATION_get_value_time (cfg, "DHT_TESTING",
3814 "MALICIOUS_PUT_FREQUENCY", 3810 "MALICIOUS_PUT_FREQUENCY",
3815 &malicious_put_frequency)) 3811 &malicious_put_frequency))
3816 malicious_put_frequency = DEFAULT_MALICIOUS_PUT_FREQUENCY; 3812 malicious_put_frequency = DEFAULT_MALICIOUS_PUT_FREQUENCY;
3817 3813
3818 if (GNUNET_YES 3814 if (GNUNET_YES ==
3819 == GNUNET_CONFIGURATION_get_value_yesno (cfg, "DHT_TESTING", 3815 GNUNET_CONFIGURATION_get_value_yesno (cfg, "DHT_TESTING",
3820 "MALICIOUS_AFTER_SETTLE")) 3816 "MALICIOUS_AFTER_SETTLE"))
3821 malicious_after_settle = GNUNET_YES; 3817 malicious_after_settle = GNUNET_YES;
3822 3818
3823 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg, "DHT_TESTING", 3819 if (GNUNET_YES ==
3824 "MALICIOUS_SYBIL")) 3820 GNUNET_CONFIGURATION_get_value_yesno (cfg, "DHT_TESTING",
3821 "MALICIOUS_SYBIL"))
3825 { 3822 {
3826 /* Set up the malicious target at random for this round */ 3823 /* Set up the malicious target at random for this round */
3827 GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, 3824 GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK,
@@ -3836,81 +3833,83 @@ run (void *cls, char *const *args, const char *cfgfile,
3836 while (1 << k < malicious_droppers) 3833 while (1 << k < malicious_droppers)
3837 k++; 3834 k++;
3838 if (malicious_droppers > 0) 3835 if (malicious_droppers > 0)
3839 malicious_bloom = GNUNET_CONTAINER_bloomfilter_init (NULL, 1 << k, 3836 malicious_bloom =
3840 DHT_BLOOM_K); 3837 GNUNET_CONTAINER_bloomfilter_init (NULL, 1 << k, DHT_BLOOM_K);
3841 3838
3842 /* The normal behavior of the DHT is to do find peer requests 3839 /* The normal behavior of the DHT is to do find peer requests
3843 * on its own. Only if this is explicitly turned off should 3840 * on its own. Only if this is explicitly turned off should
3844 * the testing driver issue find peer requests (even though 3841 * the testing driver issue find peer requests (even though
3845 * this is likely the default when testing). 3842 * this is likely the default when testing).
3846 */ 3843 */
3847 if (GNUNET_NO == GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht", 3844 if (GNUNET_NO ==
3848 "do_find_peer")) 3845 GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht", "do_find_peer"))
3849 do_find_peer = GNUNET_YES; 3846 do_find_peer = GNUNET_YES;
3850 3847
3851 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht_testing", 3848 if (GNUNET_YES ==
3852 "insert_gauger_data")) 3849 GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht_testing",
3850 "insert_gauger_data"))
3853 insert_gauger_data = GNUNET_YES; 3851 insert_gauger_data = GNUNET_YES;
3854 3852
3855 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht", 3853 if (GNUNET_YES ==
3856 "republish")) 3854 GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht", "republish"))
3857 in_dht_replication = GNUNET_YES; 3855 in_dht_replication = GNUNET_YES;
3858 3856
3859 if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_number (cfg, "DHT_TESTING", 3857 if (GNUNET_YES !=
3860 "TRIAL_TO_RUN", 3858 GNUNET_CONFIGURATION_get_value_number (cfg, "DHT_TESTING", "TRIAL_TO_RUN",
3861 &trial_to_run)) 3859 &trial_to_run))
3862 trial_to_run = 0; 3860 trial_to_run = 0;
3863 3861
3864 if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_number (cfg, "DHT_TESTING", 3862 if (GNUNET_YES !=
3865 "REVISION", 3863 GNUNET_CONFIGURATION_get_value_number (cfg, "DHT_TESTING", "REVISION",
3866 &revision)) 3864 &revision))
3867 revision = 0; 3865 revision = 0;
3868 3866
3869 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_number (cfg, "DHT_TESTING", 3867 if (GNUNET_YES ==
3870 "FIND_PEER_DELAY", 3868 GNUNET_CONFIGURATION_get_value_number (cfg, "DHT_TESTING",
3871 &temp_config_number)) 3869 "FIND_PEER_DELAY",
3872 find_peer_delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3870 &temp_config_number))
3873 temp_config_number); 3871 find_peer_delay =
3872 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
3873 temp_config_number);
3874 else 3874 else
3875 find_peer_delay = DEFAULT_FIND_PEER_DELAY; 3875 find_peer_delay = DEFAULT_FIND_PEER_DELAY;
3876 3876
3877 if (GNUNET_YES != GNUNET_CONFIGURATION_get_value_number (cfg, "DHT_TESTING", 3877 if (GNUNET_YES !=
3878 "ROUND_DELAY", 3878 GNUNET_CONFIGURATION_get_value_number (cfg, "DHT_TESTING", "ROUND_DELAY",
3879 &round_delay)) 3879 &round_delay))
3880 round_delay = 0; 3880 round_delay = 0;
3881 3881
3882 if (GNUNET_NO 3882 if (GNUNET_NO ==
3883 == GNUNET_CONFIGURATION_get_value_number (cfg, "DHT_TESTING", 3883 GNUNET_CONFIGURATION_get_value_number (cfg, "DHT_TESTING",
3884 "OUTSTANDING_FIND_PEERS", 3884 "OUTSTANDING_FIND_PEERS",
3885 &max_outstanding_find_peers)) 3885 &max_outstanding_find_peers))
3886 max_outstanding_find_peers = DEFAULT_MAX_OUTSTANDING_FIND_PEERS; 3886 max_outstanding_find_peers = DEFAULT_MAX_OUTSTANDING_FIND_PEERS;
3887 3887
3888 if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht", 3888 if (GNUNET_YES ==
3889 "strict_kademlia")) 3889 GNUNET_CONFIGURATION_get_value_yesno (cfg, "dht", "strict_kademlia"))
3890 max_outstanding_find_peers = max_outstanding_find_peers * 1; 3890 max_outstanding_find_peers = max_outstanding_find_peers * 1;
3891 3891
3892 find_peer_offset = GNUNET_TIME_relative_divide (find_peer_delay, 3892 find_peer_offset =
3893 max_outstanding_find_peers); 3893 GNUNET_TIME_relative_divide (find_peer_delay, max_outstanding_find_peers);
3894 3894
3895 if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, 3895 if (GNUNET_SYSERR ==
3896 "dht_testing", 3896 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", "num_rounds",
3897 "num_rounds", 3897 &total_rounds))
3898 &total_rounds))
3899 total_rounds = 1; 3898 total_rounds = 1;
3900 3899
3901 if ((GNUNET_SYSERR 3900 if ((GNUNET_SYSERR ==
3902 == GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing", 3901 GNUNET_CONFIGURATION_get_value_number (cfg, "dht_testing",
3903 "target_total_connections", 3902 "target_total_connections",
3904 &target_total_connections)) 3903 &target_total_connections)) ||
3905 || (target_total_connections == 0)) 3904 (target_total_connections == 0))
3906 target_total_connections = connection_estimate (num_peers, 3905 target_total_connections =
3907 DEFAULT_BUCKET_SIZE); 3906 connection_estimate (num_peers, DEFAULT_BUCKET_SIZE);
3908 3907
3909 topology_str = NULL; 3908 topology_str = NULL;
3910 if ((GNUNET_YES == GNUNET_CONFIGURATION_get_value_string (cfg, "testing", 3909 if ((GNUNET_YES ==
3911 "topology", 3910 GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "topology",
3912 &topology_str)) 3911 &topology_str)) &&
3913 && (GNUNET_NO == GNUNET_TESTING_topology_get (&topology, topology_str))) 3912 (GNUNET_NO == GNUNET_TESTING_topology_get (&topology, topology_str)))
3914 { 3913 {
3915 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 3914 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
3916 "Invalid topology `%s' given for section %s option %s\n", 3915 "Invalid topology `%s' given for section %s option %s\n",
@@ -3918,9 +3917,9 @@ run (void *cls, char *const *args, const char *cfgfile,
3918 topology = GNUNET_TESTING_TOPOLOGY_CLIQUE; /* Defaults to NONE, so set better default here */ 3917 topology = GNUNET_TESTING_TOPOLOGY_CLIQUE; /* Defaults to NONE, so set better default here */
3919 } 3918 }
3920 3919
3921 if (GNUNET_OK 3920 if (GNUNET_OK !=
3922 != GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "percentage", 3921 GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "percentage",
3923 &topology_percentage_str)) 3922 &topology_percentage_str))
3924 topology_percentage = 0.5; 3923 topology_percentage = 0.5;
3925 else 3924 else
3926 { 3925 {
@@ -3928,9 +3927,9 @@ run (void *cls, char *const *args, const char *cfgfile,
3928 GNUNET_free (topology_percentage_str); 3927 GNUNET_free (topology_percentage_str);
3929 } 3928 }
3930 3929
3931 if (GNUNET_OK 3930 if (GNUNET_OK !=
3932 != GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "probability", 3931 GNUNET_CONFIGURATION_get_value_string (cfg, "testing", "probability",
3933 &topology_probability_str)) 3932 &topology_probability_str))
3934 topology_probability = 0.5; 3933 topology_probability = 0.5;
3935 else 3934 else
3936 { 3935 {
@@ -3938,12 +3937,12 @@ run (void *cls, char *const *args, const char *cfgfile,
3938 GNUNET_free (topology_probability_str); 3937 GNUNET_free (topology_probability_str);
3939 } 3938 }
3940 3939
3941 if ((GNUNET_YES 3940 if ((GNUNET_YES ==
3942 == GNUNET_CONFIGURATION_get_value_string (cfg, "testing", 3941 GNUNET_CONFIGURATION_get_value_string (cfg, "testing",
3943 "connect_topology", 3942 "connect_topology",
3944 &connect_topology_str)) 3943 &connect_topology_str)) &&
3945 && (GNUNET_NO == GNUNET_TESTING_topology_get (&connect_topology, 3944 (GNUNET_NO ==
3946 connect_topology_str))) 3945 GNUNET_TESTING_topology_get (&connect_topology, connect_topology_str)))
3947 { 3946 {
3948 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 3947 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
3949 "Invalid connect topology `%s' given for section %s option %s\n", 3948 "Invalid connect topology `%s' given for section %s option %s\n",
@@ -3951,13 +3950,13 @@ run (void *cls, char *const *args, const char *cfgfile,
3951 } 3950 }
3952 GNUNET_free_non_null (connect_topology_str); 3951 GNUNET_free_non_null (connect_topology_str);
3953 3952
3954 if ((GNUNET_YES 3953 if ((GNUNET_YES ==
3955 == GNUNET_CONFIGURATION_get_value_string (cfg, "testing", 3954 GNUNET_CONFIGURATION_get_value_string (cfg, "testing",
3956 "connect_topology_option", 3955 "connect_topology_option",
3957 &connect_topology_option_str)) 3956 &connect_topology_option_str)) &&
3958 && (GNUNET_NO 3957 (GNUNET_NO ==
3959 == GNUNET_TESTING_topology_option_get (&connect_topology_option, 3958 GNUNET_TESTING_topology_option_get (&connect_topology_option,
3960 connect_topology_option_str))) 3959 connect_topology_option_str)))
3961 { 3960 {
3962 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 3961 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
3963 "Invalid connect topology option `%s' given for section %s option %s\n", 3962 "Invalid connect topology option `%s' given for section %s option %s\n",
@@ -3967,14 +3966,14 @@ run (void *cls, char *const *args, const char *cfgfile,
3967 } 3966 }
3968 GNUNET_free_non_null (connect_topology_option_str); 3967 GNUNET_free_non_null (connect_topology_option_str);
3969 3968
3970 if (GNUNET_YES 3969 if (GNUNET_YES ==
3971 == GNUNET_CONFIGURATION_get_value_string (cfg, 3970 GNUNET_CONFIGURATION_get_value_string (cfg, "testing",
3972 "testing", 3971 "connect_topology_option_modifier",
3973 "connect_topology_option_modifier", 3972 &connect_topology_option_modifier_string))
3974 &connect_topology_option_modifier_string))
3975 { 3973 {
3976 if (sscanf (connect_topology_option_modifier_string, "%lf", 3974 if (sscanf
3977 &connect_topology_option_modifier) != 1) 3975 (connect_topology_option_modifier_string, "%lf",
3976 &connect_topology_option_modifier) != 1)
3978 { 3977 {
3979 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 3978 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
3980 _ 3979 _
@@ -3985,18 +3984,19 @@ run (void *cls, char *const *args, const char *cfgfile,
3985 GNUNET_free (connect_topology_option_modifier_string); 3984 GNUNET_free (connect_topology_option_modifier_string);
3986 } 3985 }
3987 3986
3988 if (GNUNET_YES 3987 if (GNUNET_YES !=
3989 != GNUNET_CONFIGURATION_get_value_string (cfg, "testing", 3988 GNUNET_CONFIGURATION_get_value_string (cfg, "testing",
3990 "blacklist_transports", 3989 "blacklist_transports",
3991 &blacklist_transports)) 3990 &blacklist_transports))
3992 blacklist_transports = NULL; 3991 blacklist_transports = NULL;
3993 3992
3994 if ((GNUNET_YES 3993 if ((GNUNET_YES ==
3995 == GNUNET_CONFIGURATION_get_value_string (cfg, "testing", 3994 GNUNET_CONFIGURATION_get_value_string (cfg, "testing",
3996 "blacklist_topology", 3995 "blacklist_topology",
3997 &blacklist_topology_str)) 3996 &blacklist_topology_str)) &&
3998 && (GNUNET_NO == GNUNET_TESTING_topology_get (&blacklist_topology, 3997 (GNUNET_NO ==
3999 blacklist_topology_str))) 3998 GNUNET_TESTING_topology_get (&blacklist_topology,
3999 blacklist_topology_str)))
4000 { 4000 {
4001 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 4001 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
4002 "Invalid topology `%s' given for section %s option %s\n", 4002 "Invalid topology `%s' given for section %s option %s\n",
@@ -4009,8 +4009,7 @@ run (void *cls, char *const *args, const char *cfgfile,
4009 peers_left = num_peers; 4009 peers_left = num_peers;
4010 4010
4011 /* Set up a task to end testing if peer start fails */ 4011 /* Set up a task to end testing if peer start fails */
4012 die_task 4012 die_task =
4013 =
4014 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 4013 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
4015 (seconds_per_peer_start, num_peers), 4014 (seconds_per_peer_start, num_peers),
4016 &end_badly, 4015 &end_badly,
@@ -4025,8 +4024,8 @@ run (void *cls, char *const *args, const char *cfgfile,
4025 trial_info.blacklist_topology = blacklist_topology; 4024 trial_info.blacklist_topology = blacklist_topology;
4026 trial_info.connect_topology = connect_topology; 4025 trial_info.connect_topology = connect_topology;
4027 trial_info.connect_topology_option = connect_topology_option; 4026 trial_info.connect_topology_option = connect_topology_option;
4028 trial_info.connect_topology_option_modifier 4027 trial_info.connect_topology_option_modifier =
4029 = connect_topology_option_modifier; 4028 connect_topology_option_modifier;
4030 trial_info.topology_percentage = topology_percentage; 4029 trial_info.topology_percentage = topology_percentage;
4031 trial_info.topology_probability = topology_probability; 4030 trial_info.topology_probability = topology_probability;
4032 trial_info.puts = num_puts; 4031 trial_info.puts = num_puts;
@@ -4059,8 +4058,7 @@ run (void *cls, char *const *args, const char *cfgfile,
4059 put_meter = create_meter (num_puts, "Puts completed ", GNUNET_YES); 4058 put_meter = create_meter (num_puts, "Puts completed ", GNUNET_YES);
4060 get_meter = create_meter (num_gets, "Gets completed ", GNUNET_YES); 4059 get_meter = create_meter (num_gets, "Gets completed ", GNUNET_YES);
4061 hostkey_start_time = GNUNET_TIME_absolute_get (); 4060 hostkey_start_time = GNUNET_TIME_absolute_get ();
4062 pg = GNUNET_TESTING_daemons_start (cfg, 4061 pg = GNUNET_TESTING_daemons_start (cfg, peers_left,
4063 peers_left,
4064 max_outstanding_connections, 4062 max_outstanding_connections,
4065 max_concurrent_ssh, 4063 max_concurrent_ssh,
4066 GNUNET_TIME_relative_multiply 4064 GNUNET_TIME_relative_multiply
@@ -4088,8 +4086,9 @@ main (int argc, char *argv[])
4088 GNUNET_GETOPT_OPTION_END 4086 GNUNET_GETOPT_OPTION_END
4089 }; 4087 };
4090 4088
4091 ret = GNUNET_PROGRAM_run (argc, argv, "gnunet-dht-driver", "nohelp", options, 4089 ret =
4092 &run, &ok); 4090 GNUNET_PROGRAM_run (argc, argv, "gnunet-dht-driver", "nohelp", options,
4091 &run, &ok);
4093 4092
4094 if (malicious_bloom != NULL) 4093 if (malicious_bloom != NULL)
4095 GNUNET_CONTAINER_bloomfilter_free (malicious_bloom); 4094 GNUNET_CONTAINER_bloomfilter_free (malicious_bloom);