aboutsummaryrefslogtreecommitdiff
path: root/src/dht/test_dht_twopeer.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-10-02 14:11:03 +0000
committerChristian Grothoff <christian@grothoff.org>2010-10-02 14:11:03 +0000
commit18954ad8a33e9beda70e9b8ce122b2cf2756056d (patch)
treee0745c2459aa35969e4e93cea2ca36f57139a6d8 /src/dht/test_dht_twopeer.c
parentb9c16e59778a0ba63ab677faf081c8023df08eb5 (diff)
downloadgnunet-18954ad8a33e9beda70e9b8ce122b2cf2756056d.tar.gz
gnunet-18954ad8a33e9beda70e9b8ce122b2cf2756056d.zip
make second test compile
Diffstat (limited to 'src/dht/test_dht_twopeer.c')
-rw-r--r--src/dht/test_dht_twopeer.c40
1 files changed, 27 insertions, 13 deletions
diff --git a/src/dht/test_dht_twopeer.c b/src/dht/test_dht_twopeer.c
index f3f9e4cbd..51ba9ceb3 100644
--- a/src/dht/test_dht_twopeer.c
+++ b/src/dht/test_dht_twopeer.c
@@ -135,7 +135,8 @@ end_badly (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
135 135
136 if (curr_get_ctx.get_handle != NULL) 136 if (curr_get_ctx.get_handle != NULL)
137 { 137 {
138 GNUNET_DHT_get_stop(curr_get_ctx.get_handle, &end_badly_cont, NULL); 138 GNUNET_DHT_get_stop(curr_get_ctx.get_handle);
139 GNUNET_SCHEDULER_add_now (sched, &end_badly_cont, NULL);
139 } 140 }
140 141
141 ok = 1; 142 ok = 1;
@@ -159,8 +160,10 @@ do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc);
159void get_result_iterator (void *cls, 160void get_result_iterator (void *cls,
160 struct GNUNET_TIME_Absolute exp, 161 struct GNUNET_TIME_Absolute exp,
161 const GNUNET_HashCode * key, 162 const GNUNET_HashCode * key,
162 uint32_t type, 163 const struct GNUNET_PeerIdentity * const *get_path,
163 uint32_t size, 164 const struct GNUNET_PeerIdentity * const *put_path,
165 enum GNUNET_BLOCK_Type type,
166 size_t size,
164 const void *data) 167 const void *data)
165{ 168{
166 struct PeerGetContext *get_context = cls; 169 struct PeerGetContext *get_context = cls;
@@ -184,13 +187,15 @@ void get_result_iterator (void *cls,
184 get_context->peer = &peer1id; 187 get_context->peer = &peer1id;
185 get_context->dht_handle = peer2dht; 188 get_context->dht_handle = peer2dht;
186 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received first correct GET request response!\n"); 189 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received first correct GET request response!\n");
187 GNUNET_DHT_get_stop(get_context->get_handle, &do_get, get_context); 190 GNUNET_DHT_get_stop(get_context->get_handle);
191 GNUNET_SCHEDULER_add_now (sched, &do_get, get_context);
188 } 192 }
189 else 193 else
190 { 194 {
191 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received second correct GET request response!\n"); 195 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received second correct GET request response!\n");
192 GNUNET_SCHEDULER_cancel(sched, die_task); 196 GNUNET_SCHEDULER_cancel(sched, die_task);
193 GNUNET_DHT_get_stop(get_context->get_handle, &finish_testing, NULL); 197 GNUNET_DHT_get_stop(get_context->get_handle);
198 GNUNET_SCHEDULER_add_now (sched, &finish_testing, NULL);
194 } 199 }
195 200
196} 201}
@@ -216,8 +221,13 @@ get_stop_finished (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
216 get_context->retry_task = GNUNET_SCHEDULER_add_delayed(sched, 221 get_context->retry_task = GNUNET_SCHEDULER_add_delayed(sched,
217 GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 10), 222 GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 10),
218 &stop_retry_get, get_context); 223 &stop_retry_get, get_context);
219 get_context->get_handle = GNUNET_DHT_get_start(get_context->dht_handle, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5), 224 get_context->get_handle = GNUNET_DHT_get_start(get_context->dht_handle,
220 0, &get_context->peer->hashPubKey, &get_result_iterator, get_context, NULL, NULL); 225 GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5),
226 0 /* fixme: use real type */, &get_context->peer->hashPubKey,
227 GNUNET_DHT_RO_NONE,
228 NULL, 0,
229 NULL, 0,
230 &get_result_iterator, get_context);
221} 231}
222 232
223static void 233static void
@@ -226,10 +236,8 @@ stop_retry_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
226 struct PeerGetContext *get_context = cls; 236 struct PeerGetContext *get_context = cls;
227 get_context->retry_task = GNUNET_SCHEDULER_NO_TASK; 237 get_context->retry_task = GNUNET_SCHEDULER_NO_TASK;
228 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Get attempt %u failed, canceling request!\n", get_context->get_attempts); 238 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Get attempt %u failed, canceling request!\n", get_context->get_attempts);
229 //if (get_context->get_sent == GNUNET_YES) 239 GNUNET_DHT_get_stop(get_context->get_handle);
230 GNUNET_DHT_get_stop(get_context->get_handle, &get_stop_finished, get_context); 240 GNUNET_SCHEDULER_add_now(sched, &get_stop_finished, get_context);
231 //else
232 // GNUNET_SCHEDULER_add_now(sched, &get_stop_finished, get_context);
233} 241}
234 242
235static void 243static void
@@ -241,8 +249,14 @@ do_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
241 GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 10), 249 GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 10),
242 &stop_retry_get, get_context); 250 &stop_retry_get, get_context);
243 251
244 get_context->get_handle = GNUNET_DHT_get_start(get_context->dht_handle, GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5), 252 get_context->get_handle = GNUNET_DHT_get_start(get_context->dht_handle,
245 0, &get_context->peer->hashPubKey, &get_result_iterator, get_context, NULL, NULL); 253 GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5),
254 0 /* fixme: real type */,
255 &get_context->peer->hashPubKey,
256 GNUNET_DHT_RO_NONE,
257 NULL, 0,
258 NULL, 0,
259 &get_result_iterator, get_context);
246} 260}
247 261
248 262