diff options
Diffstat (limited to 'src/testing/testing_group.c')
-rw-r--r-- | src/testing/testing_group.c | 218 |
1 files changed, 109 insertions, 109 deletions
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index d03cb307b..88c51abe0 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c | |||
@@ -1630,19 +1630,23 @@ remove_connections (struct GNUNET_TESTING_PeerGroup *pg, unsigned int first, | |||
1630 | } | 1630 | } |
1631 | #else | 1631 | #else |
1632 | if (GNUNET_YES == | 1632 | if (GNUNET_YES == |
1633 | GNUNET_CONTAINER_multihashmap_contains (pg->peers[first]. | 1633 | GNUNET_CONTAINER_multihashmap_contains (pg-> |
1634 | blacklisted_peers, &hash_second)) | 1634 | peers[first].blacklisted_peers, |
1635 | &hash_second)) | ||
1635 | { | 1636 | { |
1636 | GNUNET_CONTAINER_multihashmap_remove_all (pg->peers[first]. | 1637 | GNUNET_CONTAINER_multihashmap_remove_all (pg-> |
1637 | blacklisted_peers, &hash_second); | 1638 | peers[first].blacklisted_peers, |
1639 | &hash_second); | ||
1638 | } | 1640 | } |
1639 | 1641 | ||
1640 | if (GNUNET_YES == | 1642 | if (GNUNET_YES == |
1641 | GNUNET_CONTAINER_multihashmap_contains (pg->peers[second]. | 1643 | GNUNET_CONTAINER_multihashmap_contains (pg-> |
1642 | blacklisted_peers, &hash_first)) | 1644 | peers[second].blacklisted_peers, |
1645 | &hash_first)) | ||
1643 | { | 1646 | { |
1644 | GNUNET_CONTAINER_multihashmap_remove_all (pg->peers[second]. | 1647 | GNUNET_CONTAINER_multihashmap_remove_all (pg-> |
1645 | blacklisted_peers, &hash_first); | 1648 | peers[second].blacklisted_peers, |
1649 | &hash_first); | ||
1646 | } | 1650 | } |
1647 | #endif | 1651 | #endif |
1648 | 1652 | ||
@@ -2864,8 +2868,8 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg) | |||
2864 | conn_iter = pg->peers[pg_iter].allowed_peers_head; | 2868 | conn_iter = pg->peers[pg_iter].allowed_peers_head; |
2865 | while (conn_iter != NULL) | 2869 | while (conn_iter != NULL) |
2866 | { | 2870 | { |
2867 | GNUNET_CRYPTO_hash_to_enc (&pg->peers[conn_iter->index].daemon->id. | 2871 | GNUNET_CRYPTO_hash_to_enc (&pg->peers[conn_iter->index].daemon-> |
2868 | hashPubKey, &peer_enc); | 2872 | id.hashPubKey, &peer_enc); |
2869 | fprintf (temp_friend_handle, "%s\n", (char *) &peer_enc); | 2873 | fprintf (temp_friend_handle, "%s\n", (char *) &peer_enc); |
2870 | conn_iter = conn_iter->next; | 2874 | conn_iter = conn_iter->next; |
2871 | } | 2875 | } |
@@ -3051,15 +3055,16 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg, | |||
3051 | conn_iter = pg->peers[pg_iter].blacklisted_peers_head; | 3055 | conn_iter = pg->peers[pg_iter].blacklisted_peers_head; |
3052 | while (conn_iter != NULL) | 3056 | while (conn_iter != NULL) |
3053 | { | 3057 | { |
3054 | GNUNET_CRYPTO_hash_to_enc (&pg->peers[conn_iter->index].daemon->id. | 3058 | GNUNET_CRYPTO_hash_to_enc (&pg->peers[conn_iter->index].daemon-> |
3055 | hashPubKey, &peer_enc); | 3059 | id.hashPubKey, &peer_enc); |
3056 | fprintf (temp_file_handle, "%s:%s\n", pos, (char *) &peer_enc); | 3060 | fprintf (temp_file_handle, "%s:%s\n", pos, (char *) &peer_enc); |
3057 | conn_iter = conn_iter->next; | 3061 | conn_iter = conn_iter->next; |
3058 | } | 3062 | } |
3059 | #else | 3063 | #else |
3060 | blacklist_ctx.transport = pos; | 3064 | blacklist_ctx.transport = pos; |
3061 | (void) GNUNET_CONTAINER_multihashmap_iterate (pg->peers[pg_iter]. | 3065 | (void) GNUNET_CONTAINER_multihashmap_iterate (pg-> |
3062 | blacklisted_peers, | 3066 | peers |
3067 | [pg_iter].blacklisted_peers, | ||
3063 | &blacklist_file_iterator, | 3068 | &blacklist_file_iterator, |
3064 | &blacklist_ctx); | 3069 | &blacklist_ctx); |
3065 | #endif | 3070 | #endif |
@@ -3176,8 +3181,8 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg, | |||
3176 | } | 3181 | } |
3177 | 3182 | ||
3178 | /* Forward Declaration */ | 3183 | /* Forward Declaration */ |
3179 | static void schedule_connect (void *cls, | 3184 | static void |
3180 | const struct GNUNET_SCHEDULER_TaskContext *tc); | 3185 | schedule_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); |
3181 | 3186 | ||
3182 | /** | 3187 | /** |
3183 | * Choose a random peer's next connection to create, and | 3188 | * Choose a random peer's next connection to create, and |
@@ -3216,9 +3221,8 @@ preschedule_connect (struct GNUNET_TESTING_PeerGroup *pg) | |||
3216 | 3221 | ||
3217 | #if USE_SEND_HELLOS | 3222 | #if USE_SEND_HELLOS |
3218 | /* Forward declaration */ | 3223 | /* Forward declaration */ |
3219 | static void schedule_send_hellos (void *cls, | 3224 | static void |
3220 | const struct GNUNET_SCHEDULER_TaskContext | 3225 | schedule_send_hellos (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); |
3221 | *tc); | ||
3222 | 3226 | ||
3223 | /** | 3227 | /** |
3224 | * Close connections and free the hello context. | 3228 | * Close connections and free the hello context. |
@@ -3319,19 +3323,19 @@ send_core_connect_requests (void *cls, | |||
3319 | conn = send_hello_context->peer->connect_peers_head; | 3323 | conn = send_hello_context->peer->connect_peers_head; |
3320 | while (conn != NULL) | 3324 | while (conn != NULL) |
3321 | { | 3325 | { |
3322 | GNUNET_CORE_peer_request_connect (send_hello_context->peer->daemon-> | 3326 | GNUNET_CORE_peer_request_connect (send_hello_context->peer-> |
3323 | server, | 3327 | daemon->server, |
3324 | &send_hello_context->pg->peers[conn-> | 3328 | &send_hello_context->pg-> |
3325 | index]. | 3329 | peers[conn->index].daemon->id, NULL, |
3326 | daemon->id, NULL, NULL); | 3330 | NULL); |
3327 | conn = conn->next; | 3331 | conn = conn->next; |
3328 | } | 3332 | } |
3329 | send_hello_context->core_connect_task = | 3333 | send_hello_context->core_connect_task = |
3330 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_divide | 3334 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_divide |
3331 | (send_hello_context->pg->ct_ctx. | 3335 | (send_hello_context->pg-> |
3332 | connect_timeout, | 3336 | ct_ctx.connect_timeout, |
3333 | send_hello_context->pg->ct_ctx. | 3337 | send_hello_context->pg-> |
3334 | connect_attempts), | 3338 | ct_ctx.connect_attempts), |
3335 | &send_core_connect_requests, | 3339 | &send_core_connect_requests, |
3336 | send_hello_context); | 3340 | send_hello_context); |
3337 | } | 3341 | } |
@@ -3522,10 +3526,10 @@ hello_sent_callback (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
3522 | 3526 | ||
3523 | send_hello_context->core_connect_task = | 3527 | send_hello_context->core_connect_task = |
3524 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_divide | 3528 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_divide |
3525 | (send_hello_context->pg->ct_ctx. | 3529 | (send_hello_context->pg-> |
3526 | connect_timeout, | 3530 | ct_ctx.connect_timeout, |
3527 | send_hello_context->pg->ct_ctx. | 3531 | send_hello_context->pg-> |
3528 | connect_attempts), | 3532 | ct_ctx.connect_attempts), |
3529 | &send_core_connect_requests, | 3533 | &send_core_connect_requests, |
3530 | send_hello_context); | 3534 | send_hello_context); |
3531 | } | 3535 | } |
@@ -3584,14 +3588,14 @@ schedule_send_hellos (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
3584 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 3588 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
3585 | _("Offering Hello of peer %s to peer %s\n"), | 3589 | _("Offering Hello of peer %s to peer %s\n"), |
3586 | send_hello_context->peer->daemon->shortname, | 3590 | send_hello_context->peer->daemon->shortname, |
3587 | pg->peers[send_hello_context->peer_pos->index].daemon-> | 3591 | pg->peers[send_hello_context->peer_pos->index]. |
3588 | shortname); | 3592 | daemon->shortname); |
3589 | #endif | 3593 | #endif |
3590 | GNUNET_TRANSPORT_offer_hello (send_hello_context->peer->daemon->th, | 3594 | GNUNET_TRANSPORT_offer_hello (send_hello_context->peer->daemon->th, |
3591 | (const struct GNUNET_MessageHeader *) pg-> | 3595 | (const struct GNUNET_MessageHeader *) |
3592 | peers[send_hello_context->peer_pos->index]. | 3596 | pg->peers[send_hello_context->peer_pos-> |
3593 | daemon->hello, &hello_sent_callback, | 3597 | index].daemon->hello, |
3594 | send_hello_context); | 3598 | &hello_sent_callback, send_hello_context); |
3595 | send_hello_context->peer_pos = send_hello_context->peer_pos->next; | 3599 | send_hello_context->peer_pos = send_hello_context->peer_pos->next; |
3596 | GNUNET_assert (send_hello_context->peer->daemon->th != NULL); | 3600 | GNUNET_assert (send_hello_context->peer->daemon->th != NULL); |
3597 | } | 3601 | } |
@@ -3647,10 +3651,12 @@ internal_connect_notify (void *cls, const struct GNUNET_PeerIdentity *first, | |||
3647 | second_cfg, first_cfg, second_daemon, first_daemon, | 3651 | second_cfg, first_cfg, second_daemon, first_daemon, |
3648 | emsg); | 3652 | emsg); |
3649 | 3653 | ||
3650 | GNUNET_CONTAINER_DLL_remove (pg->peers[connect_ctx->second_index]. | 3654 | GNUNET_CONTAINER_DLL_remove (pg-> |
3651 | connect_peers_head, | 3655 | peers[connect_ctx-> |
3652 | pg->peers[connect_ctx->second_index]. | 3656 | second_index].connect_peers_head, |
3653 | connect_peers_tail, connection); | 3657 | pg->peers[connect_ctx-> |
3658 | second_index].connect_peers_tail, | ||
3659 | connection); | ||
3654 | GNUNET_free (connection); | 3660 | GNUNET_free (connection); |
3655 | } | 3661 | } |
3656 | 3662 | ||
@@ -3711,10 +3717,10 @@ schedule_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
3711 | #endif | 3717 | #endif |
3712 | pg->outstanding_connects++; | 3718 | pg->outstanding_connects++; |
3713 | pg->total_connects_scheduled++; | 3719 | pg->total_connects_scheduled++; |
3714 | GNUNET_TESTING_daemons_connect (pg->peers[connect_context->first_index]. | 3720 | GNUNET_TESTING_daemons_connect (pg-> |
3715 | daemon, | 3721 | peers[connect_context->first_index].daemon, |
3716 | pg->peers[connect_context->second_index]. | 3722 | pg->peers[connect_context-> |
3717 | daemon, | 3723 | second_index].daemon, |
3718 | connect_context->ct_ctx->connect_timeout, | 3724 | connect_context->ct_ctx->connect_timeout, |
3719 | connect_context->ct_ctx->connect_attempts, | 3725 | connect_context->ct_ctx->connect_attempts, |
3720 | #if USE_SEND_HELLOS | 3726 | #if USE_SEND_HELLOS |
@@ -4224,8 +4230,8 @@ random_connect_iterator (void *cls, const GNUNET_HashCode * key, void *value) | |||
4224 | if (random_number < random_ctx->percentage) | 4230 | if (random_number < random_ctx->percentage) |
4225 | { | 4231 | { |
4226 | GNUNET_assert (GNUNET_OK == | 4232 | GNUNET_assert (GNUNET_OK == |
4227 | GNUNET_CONTAINER_multihashmap_put (random_ctx->first-> | 4233 | GNUNET_CONTAINER_multihashmap_put (random_ctx-> |
4228 | connect_peers_working_set, | 4234 | first->connect_peers_working_set, |
4229 | key, value, | 4235 | key, value, |
4230 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 4236 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
4231 | } | 4237 | } |
@@ -4235,12 +4241,12 @@ random_connect_iterator (void *cls, const GNUNET_HashCode * key, void *value) | |||
4235 | hash_from_uid (random_ctx->first_uid, &first_hash); | 4241 | hash_from_uid (random_ctx->first_uid, &first_hash); |
4236 | GNUNET_assert (random_ctx->pg->total > second_pos); | 4242 | GNUNET_assert (random_ctx->pg->total > second_pos); |
4237 | GNUNET_assert (GNUNET_YES == | 4243 | GNUNET_assert (GNUNET_YES == |
4238 | GNUNET_CONTAINER_multihashmap_remove (random_ctx->pg-> | 4244 | GNUNET_CONTAINER_multihashmap_remove (random_ctx-> |
4239 | peers[second_pos]. | 4245 | pg->peers |
4240 | connect_peers, | 4246 | [second_pos].connect_peers, |
4241 | &first_hash, | 4247 | &first_hash, |
4242 | random_ctx->first-> | 4248 | random_ctx-> |
4243 | daemon)); | 4249 | first->daemon)); |
4244 | 4250 | ||
4245 | return GNUNET_YES; | 4251 | return GNUNET_YES; |
4246 | } | 4252 | } |
@@ -4270,29 +4276,29 @@ minimum_connect_iterator (void *cls, const GNUNET_HashCode * key, void *value) | |||
4270 | if (min_ctx->pg_array[i] == min_ctx->current) | 4276 | if (min_ctx->pg_array[i] == min_ctx->current) |
4271 | { | 4277 | { |
4272 | GNUNET_assert (GNUNET_OK == | 4278 | GNUNET_assert (GNUNET_OK == |
4273 | GNUNET_CONTAINER_multihashmap_put (min_ctx->first-> | 4279 | GNUNET_CONTAINER_multihashmap_put (min_ctx-> |
4274 | connect_peers_working_set, | 4280 | first->connect_peers_working_set, |
4275 | key, value, | 4281 | key, value, |
4276 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 4282 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
4277 | uid_from_hash (key, &second_pos); | 4283 | uid_from_hash (key, &second_pos); |
4278 | hash_from_uid (min_ctx->first_uid, &first_hash); | 4284 | hash_from_uid (min_ctx->first_uid, &first_hash); |
4279 | GNUNET_assert (min_ctx->pg->total > second_pos); | 4285 | GNUNET_assert (min_ctx->pg->total > second_pos); |
4280 | GNUNET_assert (GNUNET_OK == | 4286 | GNUNET_assert (GNUNET_OK == |
4281 | GNUNET_CONTAINER_multihashmap_put (min_ctx->pg-> | 4287 | GNUNET_CONTAINER_multihashmap_put (min_ctx-> |
4282 | peers[second_pos]. | 4288 | pg->peers |
4283 | connect_peers_working_set, | 4289 | [second_pos].connect_peers_working_set, |
4284 | &first_hash, | 4290 | &first_hash, |
4285 | min_ctx-> | 4291 | min_ctx->first-> |
4286 | first->daemon, | 4292 | daemon, |
4287 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 4293 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
4288 | /* Now we have added this particular connection, remove it from the second peer's map so it's not double counted */ | 4294 | /* Now we have added this particular connection, remove it from the second peer's map so it's not double counted */ |
4289 | GNUNET_assert (GNUNET_YES == | 4295 | GNUNET_assert (GNUNET_YES == |
4290 | GNUNET_CONTAINER_multihashmap_remove (min_ctx->pg-> | 4296 | GNUNET_CONTAINER_multihashmap_remove (min_ctx-> |
4291 | peers[second_pos]. | 4297 | pg->peers |
4292 | connect_peers, | 4298 | [second_pos].connect_peers, |
4293 | &first_hash, | 4299 | &first_hash, |
4294 | min_ctx->first-> | 4300 | min_ctx-> |
4295 | daemon)); | 4301 | first->daemon)); |
4296 | } | 4302 | } |
4297 | } | 4303 | } |
4298 | min_ctx->current++; | 4304 | min_ctx->current++; |
@@ -4321,28 +4327,26 @@ dfs_connect_iterator (void *cls, const GNUNET_HashCode * key, void *value) | |||
4321 | if (dfs_ctx->current == dfs_ctx->chosen) | 4327 | if (dfs_ctx->current == dfs_ctx->chosen) |
4322 | { | 4328 | { |
4323 | GNUNET_assert (GNUNET_OK == | 4329 | GNUNET_assert (GNUNET_OK == |
4324 | GNUNET_CONTAINER_multihashmap_put (dfs_ctx->first-> | 4330 | GNUNET_CONTAINER_multihashmap_put (dfs_ctx-> |
4325 | connect_peers_working_set, | 4331 | first->connect_peers_working_set, |
4326 | key, value, | 4332 | key, value, |
4327 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 4333 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
4328 | uid_from_hash (key, &dfs_ctx->second_uid); | 4334 | uid_from_hash (key, &dfs_ctx->second_uid); |
4329 | hash_from_uid (dfs_ctx->first_uid, &first_hash); | 4335 | hash_from_uid (dfs_ctx->first_uid, &first_hash); |
4330 | GNUNET_assert (GNUNET_OK == | 4336 | GNUNET_assert (GNUNET_OK == |
4331 | GNUNET_CONTAINER_multihashmap_put (dfs_ctx->pg-> | 4337 | GNUNET_CONTAINER_multihashmap_put (dfs_ctx-> |
4332 | peers | 4338 | pg->peers[dfs_ctx-> |
4333 | [dfs_ctx->second_uid]. | 4339 | second_uid].connect_peers_working_set, |
4334 | connect_peers_working_set, | ||
4335 | &first_hash, | 4340 | &first_hash, |
4336 | dfs_ctx->first->daemon, | 4341 | dfs_ctx->first->daemon, |
4337 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 4342 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
4338 | GNUNET_assert (GNUNET_YES == | 4343 | GNUNET_assert (GNUNET_YES == |
4339 | GNUNET_CONTAINER_multihashmap_remove (dfs_ctx->pg-> | 4344 | GNUNET_CONTAINER_multihashmap_remove (dfs_ctx-> |
4340 | peers[dfs_ctx-> | 4345 | pg->peers |
4341 | second_uid]. | 4346 | [dfs_ctx->second_uid].connect_peers, |
4342 | connect_peers, | ||
4343 | &first_hash, | 4347 | &first_hash, |
4344 | dfs_ctx->first-> | 4348 | dfs_ctx-> |
4345 | daemon)); | 4349 | first->daemon)); |
4346 | /* Can't remove second from first yet because we are currently iterating, hence the return value in the DFSContext! */ | 4350 | /* Can't remove second from first yet because we are currently iterating, hence the return value in the DFSContext! */ |
4347 | return GNUNET_NO; /* We have found our peer, don't iterate more */ | 4351 | return GNUNET_NO; /* We have found our peer, don't iterate more */ |
4348 | } | 4352 | } |
@@ -4469,8 +4473,9 @@ count_workingset_connections (struct GNUNET_TESTING_PeerGroup *pg) | |||
4469 | } | 4473 | } |
4470 | #else | 4474 | #else |
4471 | count += | 4475 | count += |
4472 | GNUNET_CONTAINER_multihashmap_size (pg->peers[pg_iter]. | 4476 | GNUNET_CONTAINER_multihashmap_size (pg-> |
4473 | connect_peers_working_set); | 4477 | peers |
4478 | [pg_iter].connect_peers_working_set); | ||
4474 | #endif | 4479 | #endif |
4475 | } | 4480 | } |
4476 | 4481 | ||
@@ -4561,10 +4566,8 @@ choose_minimum (struct GNUNET_TESTING_PeerGroup *pg, unsigned int num) | |||
4561 | minimum_ctx.first_uid = pg_iter; | 4566 | minimum_ctx.first_uid = pg_iter; |
4562 | minimum_ctx.pg_array = | 4567 | minimum_ctx.pg_array = |
4563 | GNUNET_CRYPTO_random_permute (GNUNET_CRYPTO_QUALITY_WEAK, | 4568 | GNUNET_CRYPTO_random_permute (GNUNET_CRYPTO_QUALITY_WEAK, |
4564 | GNUNET_CONTAINER_multihashmap_size (pg-> | 4569 | GNUNET_CONTAINER_multihashmap_size |
4565 | peers | 4570 | (pg->peers[pg_iter].connect_peers)); |
4566 | [pg_iter]. | ||
4567 | connect_peers)); | ||
4568 | minimum_ctx.first = &pg->peers[pg_iter]; | 4571 | minimum_ctx.first = &pg->peers[pg_iter]; |
4569 | minimum_ctx.pg = pg; | 4572 | minimum_ctx.pg = pg; |
4570 | minimum_ctx.num_to_add = num; | 4573 | minimum_ctx.num_to_add = num; |
@@ -4654,13 +4657,13 @@ find_closest_peers (void *cls, const GNUNET_HashCode * key, void *value) | |||
4654 | &closest_ctx->curr_peer->daemon->id.hashPubKey) > | 4657 | &closest_ctx->curr_peer->daemon->id.hashPubKey) > |
4655 | closest_ctx->closest_dist)) && | 4658 | closest_ctx->closest_dist)) && |
4656 | (GNUNET_YES != | 4659 | (GNUNET_YES != |
4657 | GNUNET_CONTAINER_multihashmap_contains (closest_ctx->curr_peer-> | 4660 | GNUNET_CONTAINER_multihashmap_contains (closest_ctx-> |
4658 | connect_peers, key))) | 4661 | curr_peer->connect_peers, key))) |
4659 | { | 4662 | { |
4660 | closest_ctx->closest_dist = | 4663 | closest_ctx->closest_dist = |
4661 | GNUNET_CRYPTO_hash_matching_bits (&daemon->id.hashPubKey, | 4664 | GNUNET_CRYPTO_hash_matching_bits (&daemon->id.hashPubKey, |
4662 | &closest_ctx->curr_peer->daemon->id. | 4665 | &closest_ctx->curr_peer->daemon-> |
4663 | hashPubKey); | 4666 | id.hashPubKey); |
4664 | closest_ctx->closest = daemon; | 4667 | closest_ctx->closest = daemon; |
4665 | uid_from_hash (key, &closest_ctx->closest_num); | 4668 | uid_from_hash (key, &closest_ctx->closest_num); |
4666 | } | 4669 | } |
@@ -4747,8 +4750,8 @@ perform_dfs (struct GNUNET_TESTING_PeerGroup *pg, unsigned int num) | |||
4747 | for (pg_iter = 0; pg_iter < pg->total; pg_iter++) | 4750 | for (pg_iter = 0; pg_iter < pg->total; pg_iter++) |
4748 | { | 4751 | { |
4749 | temp_count = | 4752 | temp_count = |
4750 | count_connections (pg->peers[pg_iter]. | 4753 | count_connections (pg-> |
4751 | connect_peers_working_set_head); | 4754 | peers[pg_iter].connect_peers_working_set_head); |
4752 | if (temp_count < least_connections) | 4755 | if (temp_count < least_connections) |
4753 | { | 4756 | { |
4754 | starting_peer = pg_iter; | 4757 | starting_peer = pg_iter; |
@@ -4802,8 +4805,9 @@ perform_dfs (struct GNUNET_TESTING_PeerGroup *pg, unsigned int num) | |||
4802 | { | 4805 | { |
4803 | starting_peer = pg_iter; | 4806 | starting_peer = pg_iter; |
4804 | least_connections = | 4807 | least_connections = |
4805 | GNUNET_CONTAINER_multihashmap_size (pg->peers[pg_iter]. | 4808 | GNUNET_CONTAINER_multihashmap_size (pg-> |
4806 | connect_peers_working_set); | 4809 | peers |
4810 | [pg_iter].connect_peers_working_set); | ||
4807 | } | 4811 | } |
4808 | } | 4812 | } |
4809 | } | 4813 | } |
@@ -4817,28 +4821,25 @@ perform_dfs (struct GNUNET_TESTING_PeerGroup *pg, unsigned int num) | |||
4817 | /* Choose a random peer from the chosen peers set of connections to add */ | 4821 | /* Choose a random peer from the chosen peers set of connections to add */ |
4818 | dfs_ctx.chosen = | 4822 | dfs_ctx.chosen = |
4819 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, | 4823 | GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, |
4820 | GNUNET_CONTAINER_multihashmap_size (pg-> | 4824 | GNUNET_CONTAINER_multihashmap_size (pg->peers |
4821 | peers | 4825 | [starting_peer].connect_peers)); |
4822 | [starting_peer]. | ||
4823 | connect_peers)); | ||
4824 | dfs_ctx.first_uid = starting_peer; | 4826 | dfs_ctx.first_uid = starting_peer; |
4825 | dfs_ctx.first = &pg->peers[starting_peer]; | 4827 | dfs_ctx.first = &pg->peers[starting_peer]; |
4826 | dfs_ctx.pg = pg; | 4828 | dfs_ctx.pg = pg; |
4827 | dfs_ctx.current = 0; | 4829 | dfs_ctx.current = 0; |
4828 | 4830 | ||
4829 | GNUNET_CONTAINER_multihashmap_iterate (pg->peers[starting_peer]. | 4831 | GNUNET_CONTAINER_multihashmap_iterate (pg-> |
4830 | connect_peers, &dfs_connect_iterator, | 4832 | peers[starting_peer].connect_peers, |
4831 | &dfs_ctx); | 4833 | &dfs_connect_iterator, &dfs_ctx); |
4832 | /* Remove the second from the first, since we will be continuing the search and may encounter the first peer again! */ | 4834 | /* Remove the second from the first, since we will be continuing the search and may encounter the first peer again! */ |
4833 | hash_from_uid (dfs_ctx.second_uid, &second_hash); | 4835 | hash_from_uid (dfs_ctx.second_uid, &second_hash); |
4834 | GNUNET_assert (GNUNET_YES == | 4836 | GNUNET_assert (GNUNET_YES == |
4835 | GNUNET_CONTAINER_multihashmap_remove (pg-> | 4837 | GNUNET_CONTAINER_multihashmap_remove (pg->peers |
4836 | peers[starting_peer]. | 4838 | [starting_peer].connect_peers, |
4837 | connect_peers, | ||
4838 | &second_hash, | 4839 | &second_hash, |
4839 | pg->peers[dfs_ctx. | 4840 | pg-> |
4840 | second_uid]. | 4841 | peers |
4841 | daemon)); | 4842 | [dfs_ctx.second_uid].daemon)); |
4842 | starting_peer = dfs_ctx.second_uid; | 4843 | starting_peer = dfs_ctx.second_uid; |
4843 | } | 4844 | } |
4844 | 4845 | ||
@@ -5620,8 +5621,8 @@ schedule_churn_restart (void *cls, | |||
5620 | { | 5621 | { |
5621 | if (startup_ctx->churn_ctx->service != NULL) | 5622 | if (startup_ctx->churn_ctx->service != NULL) |
5622 | GNUNET_TESTING_daemon_start_stopped_service (peer_restart_ctx->daemon, | 5623 | GNUNET_TESTING_daemon_start_stopped_service (peer_restart_ctx->daemon, |
5623 | startup_ctx->churn_ctx-> | 5624 | startup_ctx-> |
5624 | service, | 5625 | churn_ctx->service, |
5625 | startup_ctx->timeout, | 5626 | startup_ctx->timeout, |
5626 | &churn_start_callback, | 5627 | &churn_start_callback, |
5627 | startup_ctx); | 5628 | startup_ctx); |
@@ -5880,9 +5881,8 @@ call_hostkey_callbacks (void *cls, | |||
5880 | for (i = 0; i < pg->total; i++) | 5881 | for (i = 0; i < pg->total; i++) |
5881 | { | 5882 | { |
5882 | if (pg->peers[i].internal_context.hostkey_callback != NULL) | 5883 | if (pg->peers[i].internal_context.hostkey_callback != NULL) |
5883 | pg->peers[i].internal_context.hostkey_callback (pg-> | 5884 | pg->peers[i].internal_context.hostkey_callback (pg->peers[i]. |
5884 | peers[i].internal_context. | 5885 | internal_context.hostkey_cls, |
5885 | hostkey_cls, | ||
5886 | &pg->peers[i].daemon->id, | 5886 | &pg->peers[i].daemon->id, |
5887 | pg->peers[i].daemon, | 5887 | pg->peers[i].daemon, |
5888 | NULL); | 5888 | NULL); |