aboutsummaryrefslogtreecommitdiff
path: root/src/dht/dht_test_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dht/dht_test_lib.c')
-rw-r--r--src/dht/dht_test_lib.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/dht/dht_test_lib.c b/src/dht/dht_test_lib.c
index 4c1bd3057..52d5a3731 100644
--- a/src/dht/dht_test_lib.c
+++ b/src/dht/dht_test_lib.c
@@ -114,7 +114,6 @@ dht_connect_cb (void *cls,
114 const char *emsg) 114 const char *emsg)
115{ 115{
116 struct GNUNET_DHT_TEST_Context *ctx = cls; 116 struct GNUNET_DHT_TEST_Context *ctx = cls;
117 unsigned int i;
118 117
119 if (NULL != emsg) 118 if (NULL != emsg)
120 { 119 {
@@ -124,10 +123,10 @@ dht_connect_cb (void *cls,
124 GNUNET_SCHEDULER_shutdown (); 123 GNUNET_SCHEDULER_shutdown ();
125 return; 124 return;
126 } 125 }
127 for (i=0;i<ctx->num_peers;i++) 126 for (unsigned int i=0;i<ctx->num_peers;i++)
128 if (op == ctx->ops[i]) 127 if (op == ctx->ops[i])
129 ctx->dhts[i] = ca_result; 128 ctx->dhts[i] = ca_result;
130 for (i=0;i<ctx->num_peers;i++) 129 for (unsigned int i=0;i<ctx->num_peers;i++)
131 if (NULL == ctx->dhts[i]) 130 if (NULL == ctx->dhts[i])
132 return; /* still some DHT connections missing */ 131 return; /* still some DHT connections missing */
133 /* all DHT connections ready! */ 132 /* all DHT connections ready! */
@@ -147,9 +146,7 @@ dht_connect_cb (void *cls,
147void 146void
148GNUNET_DHT_TEST_cleanup (struct GNUNET_DHT_TEST_Context *ctx) 147GNUNET_DHT_TEST_cleanup (struct GNUNET_DHT_TEST_Context *ctx)
149{ 148{
150 unsigned int i; 149 for (unsigned int i=0;i<ctx->num_peers;i++)
151
152 for (i=0;i<ctx->num_peers;i++)
153 GNUNET_TESTBED_operation_done (ctx->ops[i]); 150 GNUNET_TESTBED_operation_done (ctx->ops[i]);
154 GNUNET_free (ctx->ops); 151 GNUNET_free (ctx->ops);
155 GNUNET_free (ctx->dhts); 152 GNUNET_free (ctx->dhts);
@@ -160,18 +157,17 @@ GNUNET_DHT_TEST_cleanup (struct GNUNET_DHT_TEST_Context *ctx)
160 157
161static void 158static void
162dht_test_run (void *cls, 159dht_test_run (void *cls,
163 struct GNUNET_TESTBED_RunHandle *h, 160 struct GNUNET_TESTBED_RunHandle *h,
164 unsigned int num_peers, 161 unsigned int num_peers,
165 struct GNUNET_TESTBED_Peer **peers, 162 struct GNUNET_TESTBED_Peer **peers,
166 unsigned int links_succeeded, 163 unsigned int links_succeeded,
167 unsigned int links_failed) 164 unsigned int links_failed)
168{ 165{
169 struct GNUNET_DHT_TEST_Context *ctx = cls; 166 struct GNUNET_DHT_TEST_Context *ctx = cls;
170 unsigned int i;
171 167
172 GNUNET_assert (num_peers == ctx->num_peers); 168 GNUNET_assert (num_peers == ctx->num_peers);
173 ctx->peers = peers; 169 ctx->peers = peers;
174 for (i=0;i<num_peers;i++) 170 for (unsigned int i=0;i<num_peers;i++)
175 ctx->ops[i] = GNUNET_TESTBED_service_connect (ctx, 171 ctx->ops[i] = GNUNET_TESTBED_service_connect (ctx,
176 peers[i], 172 peers[i],
177 "dht", 173 "dht",