diff options
author | Nathan S. Evans <evans@in.tum.de> | 2011-02-08 11:23:24 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2011-02-08 11:23:24 +0000 |
commit | b9cb7a612968c7b7347b0bc598e46435ef9600a5 (patch) | |
tree | 5826924e0cc58196215fdfb3090d4e0273e5dfc7 /src/testing/testing_group.c | |
parent | 8321c2e5520729f754dfc214e250ea9990c2a946 (diff) | |
download | gnunet-b9cb7a612968c7b7347b0bc598e46435ef9600a5.tar.gz gnunet-b9cb7a612968c7b7347b0bc598e46435ef9600a5.zip |
remove code for cpu heavy connection scheduling
Diffstat (limited to 'src/testing/testing_group.c')
-rw-r--r-- | src/testing/testing_group.c | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index 88408e871..a35a63a75 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c | |||
@@ -3064,9 +3064,6 @@ connect_topology (struct GNUNET_TESTING_PeerGroup *pg, | |||
3064 | struct ConnectTopologyContext *ct_ctx; | 3064 | struct ConnectTopologyContext *ct_ctx; |
3065 | #if OLD | 3065 | #if OLD |
3066 | struct PeerConnection *connection_iter; | 3066 | struct PeerConnection *connection_iter; |
3067 | #else | ||
3068 | struct ConnectContext *connect_context; | ||
3069 | int ret; | ||
3070 | #endif | 3067 | #endif |
3071 | 3068 | ||
3072 | total = 0; | 3069 | total = 0; |
@@ -3100,53 +3097,12 @@ connect_topology (struct GNUNET_TESTING_PeerGroup *pg, | |||
3100 | ct_ctx->remaining_connections = total; | 3097 | ct_ctx->remaining_connections = total; |
3101 | ct_ctx->remaining_connects_to_schedule = total; | 3098 | ct_ctx->remaining_connects_to_schedule = total; |
3102 | 3099 | ||
3103 | |||
3104 | /** | ||
3105 | * FIXME: iterating over peer lists in this way means that a single peer will have | ||
3106 | * all of its connections scheduled basically at once. This means a single peer | ||
3107 | * will have a lot of work to do, and may slow down the connection process. If | ||
3108 | * we could choose a connection *randomly* that would work much better. | ||
3109 | * | ||
3110 | * Even using the hashmap method we still choose all of a single peers connections. | ||
3111 | * | ||
3112 | * Will we incur a serious performance penalty iterating over the lists a bunch of | ||
3113 | * times? Probably not compared to the delays in connecting peers. Can't hurt | ||
3114 | * to try anyhow... | ||
3115 | */ | ||
3116 | for (pg_iter = 0; pg_iter < pg->max_outstanding_connections; pg_iter++) | 3100 | for (pg_iter = 0; pg_iter < pg->max_outstanding_connections; pg_iter++) |
3117 | { | 3101 | { |
3118 | preschedule_connect(ct_ctx); | 3102 | preschedule_connect(ct_ctx); |
3119 | } | 3103 | } |
3120 | return total; | 3104 | return total; |
3121 | 3105 | ||
3122 | #if SLOW | ||
3123 | total = 0; | ||
3124 | for (pg_iter = 0; pg_iter < pg->total; pg_iter++) | ||
3125 | { | ||
3126 | #if OLD | ||
3127 | connection_iter = pg->peers[pg_iter].connect_peers_head; | ||
3128 | while (connection_iter != NULL) | ||
3129 | { | ||
3130 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Scheduling connect of peer %d to peer %d\n", pg_iter, connection_iter->index); | ||
3131 | connect_context = GNUNET_malloc (sizeof (struct ConnectContext)); | ||
3132 | connect_context->first = pg->peers[pg_iter].daemon; | ||
3133 | connect_context->second = pg->peers[connection_iter->index].daemon; | ||
3134 | connect_context->ct_ctx = ct_ctx; | ||
3135 | GNUNET_SCHEDULER_add_now (&schedule_connect, connect_context); | ||
3136 | connection_iter = connection_iter->next; | ||
3137 | total++; | ||
3138 | } | ||
3139 | #else | ||
3140 | ret = | ||
3141 | GNUNET_CONTAINER_multihashmap_iterate (pg-> | ||
3142 | peers[pg_iter].connect_peers, | ||
3143 | &connect_iterator, ct_ctx); | ||
3144 | GNUNET_assert (GNUNET_SYSERR != ret && ret >= 0); | ||
3145 | total = total + ret; | ||
3146 | #endif | ||
3147 | } | ||
3148 | return total; | ||
3149 | #endif | ||
3150 | } | 3106 | } |
3151 | 3107 | ||
3152 | 3108 | ||