diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:46:35 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:46:35 +0000 |
commit | 502af2167f7c218366666ca4944bd7cc54b5b19a (patch) | |
tree | a91fec5cc9769d260640bd91c6633cb9cf395524 /src/dht/test_dht_api.c | |
parent | 03af5a603b7cc53432249d5854cd412aa90dde0d (diff) | |
download | gnunet-502af2167f7c218366666ca4944bd7cc54b5b19a.tar.gz gnunet-502af2167f7c218366666ca4944bd7cc54b5b19a.zip |
indentation
Diffstat (limited to 'src/dht/test_dht_api.c')
-rw-r--r-- | src/dht/test_dht_api.c | 254 |
1 files changed, 131 insertions, 123 deletions
diff --git a/src/dht/test_dht_api.c b/src/dht/test_dht_api.c index 4450cb653..407e2279b 100644 --- a/src/dht/test_dht_api.c +++ b/src/dht/test_dht_api.c | |||
@@ -112,7 +112,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
112 | die_task = GNUNET_SCHEDULER_NO_TASK; | 112 | die_task = GNUNET_SCHEDULER_NO_TASK; |
113 | GNUNET_DHT_disconnect (p1.dht_handle); | 113 | GNUNET_DHT_disconnect (p1.dht_handle); |
114 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 114 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
115 | "DHT disconnected, returning success!\n"); | 115 | "DHT disconnected, returning success!\n"); |
116 | ok = 0; | 116 | ok = 0; |
117 | } | 117 | } |
118 | 118 | ||
@@ -138,20 +138,20 @@ end_badly () | |||
138 | fprintf (stderr, "Ending on an unhappy note.\n"); | 138 | fprintf (stderr, "Ending on an unhappy note.\n"); |
139 | #endif | 139 | #endif |
140 | 140 | ||
141 | if ( (retry_context.peer_ctx != NULL) && | 141 | if ((retry_context.peer_ctx != NULL) && |
142 | (retry_context.peer_ctx->find_peer_handle != NULL) ) | 142 | (retry_context.peer_ctx->find_peer_handle != NULL)) |
143 | { | 143 | { |
144 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Stopping find peer request!\n"); | 144 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping find peer request!\n"); |
145 | GNUNET_DHT_find_peer_stop(retry_context.peer_ctx->find_peer_handle); | 145 | GNUNET_DHT_find_peer_stop (retry_context.peer_ctx->find_peer_handle); |
146 | } | 146 | } |
147 | if ( (retry_context.peer_ctx != NULL) && | 147 | if ((retry_context.peer_ctx != NULL) && |
148 | (retry_context.peer_ctx->get_handle != NULL) ) | 148 | (retry_context.peer_ctx->get_handle != NULL)) |
149 | { | 149 | { |
150 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Stopping get request!\n"); | 150 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopping get request!\n"); |
151 | GNUNET_DHT_get_stop (retry_context.peer_ctx->get_handle); | 151 | GNUNET_DHT_get_stop (retry_context.peer_ctx->get_handle); |
152 | } | 152 | } |
153 | if (retry_context.retry_task != GNUNET_SCHEDULER_NO_TASK) | 153 | if (retry_context.retry_task != GNUNET_SCHEDULER_NO_TASK) |
154 | GNUNET_SCHEDULER_cancel(retry_context.retry_task); | 154 | GNUNET_SCHEDULER_cancel (retry_context.retry_task); |
155 | GNUNET_DHT_disconnect (p1.dht_handle); | 155 | GNUNET_DHT_disconnect (p1.dht_handle); |
156 | ok = 1; | 156 | ok = 1; |
157 | } | 157 | } |
@@ -169,13 +169,13 @@ test_find_peer_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
169 | struct PeerContext *peer = cls; | 169 | struct PeerContext *peer = cls; |
170 | 170 | ||
171 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called test_find_peer_stop!\n"); | 171 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called test_find_peer_stop!\n"); |
172 | if ( (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT) != 0) | 172 | if ((tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT) != 0) |
173 | { | 173 | { |
174 | GNUNET_break (0); | 174 | GNUNET_break (0); |
175 | GNUNET_SCHEDULER_cancel (die_task); | 175 | GNUNET_SCHEDULER_cancel (die_task); |
176 | GNUNET_SCHEDULER_add_now (&end_badly, NULL); | 176 | GNUNET_SCHEDULER_add_now (&end_badly, NULL); |
177 | return; | 177 | return; |
178 | } | 178 | } |
179 | 179 | ||
180 | GNUNET_assert (peer->dht_handle != NULL); | 180 | GNUNET_assert (peer->dht_handle != NULL); |
181 | 181 | ||
@@ -183,12 +183,14 @@ test_find_peer_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
183 | peer->find_peer_handle = NULL; | 183 | peer->find_peer_handle = NULL; |
184 | 184 | ||
185 | #if HAVE_MALICIOUS | 185 | #if HAVE_MALICIOUS |
186 | GNUNET_DHT_set_malicious_getter (peer->dht_handle, GNUNET_TIME_UNIT_SECONDS, NULL, NULL); | 186 | GNUNET_DHT_set_malicious_getter (peer->dht_handle, GNUNET_TIME_UNIT_SECONDS, |
187 | GNUNET_DHT_set_malicious_putter (peer->dht_handle, GNUNET_TIME_UNIT_SECONDS, NULL, NULL); | 187 | NULL, NULL); |
188 | GNUNET_DHT_set_malicious_putter (peer->dht_handle, GNUNET_TIME_UNIT_SECONDS, | ||
189 | NULL, NULL); | ||
188 | GNUNET_DHT_set_malicious_dropper (peer->dht_handle, NULL, NULL); | 190 | GNUNET_DHT_set_malicious_dropper (peer->dht_handle, NULL, NULL); |
189 | #endif | 191 | #endif |
190 | GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 1), | 192 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply |
191 | &end, &p1); | 193 | (GNUNET_TIME_UNIT_SECONDS, 1), &end, &p1); |
192 | } | 194 | } |
193 | 195 | ||
194 | 196 | ||
@@ -200,32 +202,33 @@ test_find_peer_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
200 | * @param peer the peer we learned about | 202 | * @param peer the peer we learned about |
201 | * @param reply response | 203 | * @param reply response |
202 | */ | 204 | */ |
203 | void test_find_peer_processor (void *cls, | 205 | void |
204 | const struct GNUNET_HELLO_Message *hello) | 206 | test_find_peer_processor (void *cls, const struct GNUNET_HELLO_Message *hello) |
205 | { | 207 | { |
206 | struct RetryContext *retry_ctx = cls; | 208 | struct RetryContext *retry_ctx = cls; |
207 | struct GNUNET_PeerIdentity peer; | 209 | struct GNUNET_PeerIdentity peer; |
208 | 210 | ||
209 | if (GNUNET_OK == GNUNET_HELLO_get_id(hello, &peer)) | 211 | if (GNUNET_OK == GNUNET_HELLO_get_id (hello, &peer)) |
210 | { | 212 | { |
211 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 213 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
212 | "test_find_peer_processor called (peer `%s'), stopping find peer request!\n", GNUNET_i2s(&peer)); | 214 | "test_find_peer_processor called (peer `%s'), stopping find peer request!\n", |
213 | 215 | GNUNET_i2s (&peer)); | |
214 | if (retry_ctx->retry_task != GNUNET_SCHEDULER_NO_TASK) | ||
215 | { | ||
216 | GNUNET_SCHEDULER_cancel(retry_ctx->retry_task); | ||
217 | retry_ctx->retry_task = GNUNET_SCHEDULER_NO_TASK; | ||
218 | } | ||
219 | 216 | ||
220 | GNUNET_SCHEDULER_add_continuation (&test_find_peer_stop, &p1, | 217 | if (retry_ctx->retry_task != GNUNET_SCHEDULER_NO_TASK) |
221 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
222 | } | ||
223 | else | ||
224 | { | 218 | { |
225 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 219 | GNUNET_SCHEDULER_cancel (retry_ctx->retry_task); |
226 | "received find peer request, but hello_get_id failed!\n"); | 220 | retry_ctx->retry_task = GNUNET_SCHEDULER_NO_TASK; |
227 | } | 221 | } |
228 | 222 | ||
223 | GNUNET_SCHEDULER_add_continuation (&test_find_peer_stop, &p1, | ||
224 | GNUNET_SCHEDULER_REASON_PREREQ_DONE); | ||
225 | } | ||
226 | else | ||
227 | { | ||
228 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
229 | "received find peer request, but hello_get_id failed!\n"); | ||
230 | } | ||
231 | |||
229 | } | 232 | } |
230 | 233 | ||
231 | /** | 234 | /** |
@@ -248,35 +251,40 @@ retry_find_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
248 | { | 251 | { |
249 | struct RetryContext *retry_ctx = cls; | 252 | struct RetryContext *retry_ctx = cls; |
250 | GNUNET_HashCode hash; | 253 | GNUNET_HashCode hash; |
254 | |||
251 | memset (&hash, 42, sizeof (GNUNET_HashCode)); | 255 | memset (&hash, 42, sizeof (GNUNET_HashCode)); |
252 | 256 | ||
253 | if (GNUNET_TIME_absolute_get_remaining(retry_ctx->real_timeout).rel_value > 0) | 257 | if (GNUNET_TIME_absolute_get_remaining (retry_ctx->real_timeout).rel_value > |
254 | { | 258 | 0) |
255 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 259 | { |
256 | "test_find_peer timed out, retrying!\n"); | 260 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
257 | retry_ctx->next_timeout = GNUNET_TIME_relative_multiply(retry_ctx->next_timeout, 2); | 261 | "test_find_peer timed out, retrying!\n"); |
258 | retry_ctx->peer_ctx->find_peer_handle | 262 | retry_ctx->next_timeout = |
259 | = GNUNET_DHT_find_peer_start (retry_ctx->peer_ctx->dht_handle, | 263 | GNUNET_TIME_relative_multiply (retry_ctx->next_timeout, 2); |
260 | retry_ctx->next_timeout, &hash, | 264 | retry_ctx->peer_ctx->find_peer_handle = |
261 | GNUNET_DHT_RO_NONE, | 265 | GNUNET_DHT_find_peer_start (retry_ctx->peer_ctx->dht_handle, |
262 | &test_find_peer_processor, retry_ctx); | 266 | retry_ctx->next_timeout, &hash, |
263 | } | 267 | GNUNET_DHT_RO_NONE, |
268 | &test_find_peer_processor, retry_ctx); | ||
269 | } | ||
264 | else | 270 | else |
265 | { | 271 | { |
266 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 272 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
267 | "test_find_peer timed out for good, failing!\n"); | 273 | "test_find_peer timed out for good, failing!\n"); |
268 | 274 | ||
269 | retry_ctx->peer_ctx->find_peer_handle = NULL; | 275 | retry_ctx->peer_ctx->find_peer_handle = NULL; |
270 | } | 276 | } |
271 | 277 | ||
272 | if (retry_ctx->peer_ctx->find_peer_handle == NULL) | 278 | if (retry_ctx->peer_ctx->find_peer_handle == NULL) |
273 | { | 279 | { |
274 | GNUNET_break (0); | 280 | GNUNET_break (0); |
275 | GNUNET_SCHEDULER_cancel (die_task); | 281 | GNUNET_SCHEDULER_cancel (die_task); |
276 | GNUNET_SCHEDULER_add_now (&end_badly, &p1); | 282 | GNUNET_SCHEDULER_add_now (&end_badly, &p1); |
277 | return; | 283 | return; |
278 | } | 284 | } |
279 | retry_ctx->retry_task = GNUNET_SCHEDULER_add_delayed(retry_ctx->next_timeout, &retry_find_peer_stop, retry_ctx); | 285 | retry_ctx->retry_task = |
286 | GNUNET_SCHEDULER_add_delayed (retry_ctx->next_timeout, | ||
287 | &retry_find_peer_stop, retry_ctx); | ||
280 | } | 288 | } |
281 | 289 | ||
282 | /** | 290 | /** |
@@ -290,13 +298,14 @@ retry_find_peer_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
290 | { | 298 | { |
291 | struct RetryContext *retry_ctx = cls; | 299 | struct RetryContext *retry_ctx = cls; |
292 | GNUNET_HashCode hash; | 300 | GNUNET_HashCode hash; |
301 | |||
293 | memset (&hash, 42, sizeof (GNUNET_HashCode)); | 302 | memset (&hash, 42, sizeof (GNUNET_HashCode)); |
294 | 303 | ||
295 | if (retry_ctx->peer_ctx->find_peer_handle != NULL) | 304 | if (retry_ctx->peer_ctx->find_peer_handle != NULL) |
296 | { | 305 | { |
297 | GNUNET_DHT_find_peer_stop(retry_ctx->peer_ctx->find_peer_handle); | 306 | GNUNET_DHT_find_peer_stop (retry_ctx->peer_ctx->find_peer_handle); |
298 | retry_ctx->peer_ctx->find_peer_handle = NULL; | 307 | retry_ctx->peer_ctx->find_peer_handle = NULL; |
299 | } | 308 | } |
300 | GNUNET_SCHEDULER_add_now (&retry_find_peer, retry_ctx); | 309 | GNUNET_SCHEDULER_add_now (&retry_find_peer, retry_ctx); |
301 | } | 310 | } |
302 | 311 | ||
@@ -311,29 +320,32 @@ test_find_peer (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
311 | { | 320 | { |
312 | struct PeerContext *peer = cls; | 321 | struct PeerContext *peer = cls; |
313 | GNUNET_HashCode hash; | 322 | GNUNET_HashCode hash; |
323 | |||
314 | memset (&hash, 42, sizeof (GNUNET_HashCode)); | 324 | memset (&hash, 42, sizeof (GNUNET_HashCode)); |
315 | 325 | ||
316 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called test_find_peer!\n"); | 326 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called test_find_peer!\n"); |
317 | GNUNET_assert (peer->dht_handle != NULL); | 327 | GNUNET_assert (peer->dht_handle != NULL); |
318 | 328 | ||
319 | retry_context.real_timeout = GNUNET_TIME_relative_to_absolute(TOTAL_TIMEOUT); | 329 | retry_context.real_timeout = GNUNET_TIME_relative_to_absolute (TOTAL_TIMEOUT); |
320 | retry_context.next_timeout = BASE_TIMEOUT; | 330 | retry_context.next_timeout = BASE_TIMEOUT; |
321 | retry_context.peer_ctx = peer; | 331 | retry_context.peer_ctx = peer; |
322 | 332 | ||
323 | peer->find_peer_handle | 333 | peer->find_peer_handle |
324 | = GNUNET_DHT_find_peer_start (peer->dht_handle, retry_context.next_timeout, | 334 | = |
325 | &hash, | 335 | GNUNET_DHT_find_peer_start (peer->dht_handle, retry_context.next_timeout, |
326 | GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, | 336 | &hash, GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE, |
327 | &test_find_peer_processor, &retry_context); | 337 | &test_find_peer_processor, &retry_context); |
328 | 338 | ||
329 | if (peer->find_peer_handle == NULL) | 339 | if (peer->find_peer_handle == NULL) |
330 | { | 340 | { |
331 | GNUNET_break (0); | 341 | GNUNET_break (0); |
332 | GNUNET_SCHEDULER_cancel (die_task); | 342 | GNUNET_SCHEDULER_cancel (die_task); |
333 | GNUNET_SCHEDULER_add_now (&end_badly, &p1); | 343 | GNUNET_SCHEDULER_add_now (&end_badly, &p1); |
334 | return; | 344 | return; |
335 | } | 345 | } |
336 | retry_context.retry_task = GNUNET_SCHEDULER_add_delayed(retry_context.next_timeout, &retry_find_peer_stop, &retry_context); | 346 | retry_context.retry_task = |
347 | GNUNET_SCHEDULER_add_delayed (retry_context.next_timeout, | ||
348 | &retry_find_peer_stop, &retry_context); | ||
337 | } | 349 | } |
338 | 350 | ||
339 | /** | 351 | /** |
@@ -348,28 +360,26 @@ test_get_stop (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
348 | struct PeerContext *peer = cls; | 360 | struct PeerContext *peer = cls; |
349 | 361 | ||
350 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called test_get_stop!\n"); | 362 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called test_get_stop!\n"); |
351 | if ( (tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT) != 0) | 363 | if ((tc->reason & GNUNET_SCHEDULER_REASON_TIMEOUT) != 0) |
352 | { | 364 | { |
353 | GNUNET_break (0); | 365 | GNUNET_break (0); |
354 | GNUNET_SCHEDULER_cancel (die_task); | 366 | GNUNET_SCHEDULER_cancel (die_task); |
355 | GNUNET_SCHEDULER_add_now (&end_badly, NULL); | 367 | GNUNET_SCHEDULER_add_now (&end_badly, NULL); |
356 | return; | 368 | return; |
357 | } | 369 | } |
358 | GNUNET_assert (peer->dht_handle != NULL); | 370 | GNUNET_assert (peer->dht_handle != NULL); |
359 | GNUNET_DHT_get_stop (peer->get_handle); | 371 | GNUNET_DHT_get_stop (peer->get_handle); |
360 | peer->get_handle = NULL; | 372 | peer->get_handle = NULL; |
361 | GNUNET_SCHEDULER_add_now(&test_find_peer, | 373 | GNUNET_SCHEDULER_add_now (&test_find_peer, &p1); |
362 | &p1); | ||
363 | } | 374 | } |
364 | 375 | ||
365 | void | 376 | void |
366 | test_get_iterator (void *cls, | 377 | test_get_iterator (void *cls, |
367 | struct GNUNET_TIME_Absolute exp, | 378 | struct GNUNET_TIME_Absolute exp, |
368 | const GNUNET_HashCode * key, | 379 | const GNUNET_HashCode * key, |
369 | const struct GNUNET_PeerIdentity * const *get_path, | 380 | const struct GNUNET_PeerIdentity *const *get_path, |
370 | const struct GNUNET_PeerIdentity * const *put_path, | 381 | const struct GNUNET_PeerIdentity *const *put_path, |
371 | enum GNUNET_BLOCK_Type type, | 382 | enum GNUNET_BLOCK_Type type, size_t size, const void *data) |
372 | size_t size, const void *data) | ||
373 | { | 383 | { |
374 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 384 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
375 | "test_get_iterator called (we got a result), stopping get request!\n"); | 385 | "test_get_iterator called (we got a result), stopping get request!\n"); |
@@ -389,32 +399,31 @@ test_get (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
389 | { | 399 | { |
390 | struct PeerContext *peer = cls; | 400 | struct PeerContext *peer = cls; |
391 | GNUNET_HashCode hash; | 401 | GNUNET_HashCode hash; |
402 | |||
392 | memset (&hash, 42, sizeof (GNUNET_HashCode)); | 403 | memset (&hash, 42, sizeof (GNUNET_HashCode)); |
393 | 404 | ||
394 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called test_get!\n"); | 405 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Called test_get!\n"); |
395 | 406 | ||
396 | GNUNET_assert (peer->dht_handle != NULL); | 407 | GNUNET_assert (peer->dht_handle != NULL); |
397 | retry_context.real_timeout = GNUNET_TIME_relative_to_absolute(TOTAL_TIMEOUT); | 408 | retry_context.real_timeout = GNUNET_TIME_relative_to_absolute (TOTAL_TIMEOUT); |
398 | retry_context.next_timeout = BASE_TIMEOUT; | 409 | retry_context.next_timeout = BASE_TIMEOUT; |
399 | 410 | ||
400 | peer->get_handle = | 411 | peer->get_handle = |
401 | GNUNET_DHT_get_start (peer->dht_handle, | 412 | GNUNET_DHT_get_start (peer->dht_handle, |
402 | TOTAL_TIMEOUT, | 413 | TOTAL_TIMEOUT, |
403 | GNUNET_BLOCK_TYPE_TEST, | 414 | GNUNET_BLOCK_TYPE_TEST, |
404 | &hash, | 415 | &hash, |
405 | DEFAULT_GET_REPLICATION, | 416 | DEFAULT_GET_REPLICATION, |
406 | GNUNET_DHT_RO_NONE, | 417 | GNUNET_DHT_RO_NONE, |
407 | NULL, 0, | 418 | NULL, 0, NULL, 0, &test_get_iterator, NULL); |
408 | NULL, 0, | ||
409 | &test_get_iterator, NULL); | ||
410 | 419 | ||
411 | if (peer->get_handle == NULL) | 420 | if (peer->get_handle == NULL) |
412 | { | 421 | { |
413 | GNUNET_break (0); | 422 | GNUNET_break (0); |
414 | GNUNET_SCHEDULER_cancel (die_task); | 423 | GNUNET_SCHEDULER_cancel (die_task); |
415 | GNUNET_SCHEDULER_add_now (&end_badly, &p1); | 424 | GNUNET_SCHEDULER_add_now (&end_badly, &p1); |
416 | return; | 425 | return; |
417 | } | 426 | } |
418 | 427 | ||
419 | retry_context.peer_ctx = peer; | 428 | retry_context.peer_ctx = peer; |
420 | } | 429 | } |
@@ -432,6 +441,7 @@ test_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
432 | GNUNET_HashCode hash; | 441 | GNUNET_HashCode hash; |
433 | char *data; | 442 | char *data; |
434 | size_t data_size = 42; | 443 | size_t data_size = 42; |
444 | |||
435 | memset (&hash, 42, sizeof (GNUNET_HashCode)); | 445 | memset (&hash, 42, sizeof (GNUNET_HashCode)); |
436 | data = GNUNET_malloc (data_size); | 446 | data = GNUNET_malloc (data_size); |
437 | memset (data, 43, data_size); | 447 | memset (data, 43, data_size); |
@@ -440,15 +450,14 @@ test_put (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
440 | 450 | ||
441 | GNUNET_assert (peer->dht_handle != NULL); | 451 | GNUNET_assert (peer->dht_handle != NULL); |
442 | 452 | ||
443 | GNUNET_DHT_put (peer->dht_handle, &hash, | 453 | GNUNET_DHT_put (peer->dht_handle, &hash, |
444 | DEFAULT_PUT_REPLICATION, | 454 | DEFAULT_PUT_REPLICATION, |
445 | GNUNET_DHT_RO_NONE, | 455 | GNUNET_DHT_RO_NONE, |
446 | GNUNET_BLOCK_TYPE_TEST, | 456 | GNUNET_BLOCK_TYPE_TEST, |
447 | data_size, data, | 457 | data_size, data, |
448 | GNUNET_TIME_relative_to_absolute (TOTAL_TIMEOUT), | 458 | GNUNET_TIME_relative_to_absolute (TOTAL_TIMEOUT), |
449 | TOTAL_TIMEOUT, | 459 | TOTAL_TIMEOUT, &test_get, &p1); |
450 | &test_get, &p1); | 460 | GNUNET_free (data); |
451 | GNUNET_free(data); | ||
452 | } | 461 | } |
453 | 462 | ||
454 | static void | 463 | static void |
@@ -457,11 +466,11 @@ setup_peer (struct PeerContext *p, const char *cfgname) | |||
457 | p->cfg = GNUNET_CONFIGURATION_create (); | 466 | p->cfg = GNUNET_CONFIGURATION_create (); |
458 | #if START_ARM | 467 | #if START_ARM |
459 | p->arm_proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", | 468 | p->arm_proc = GNUNET_OS_start_process (NULL, NULL, "gnunet-service-arm", |
460 | "gnunet-service-arm", | 469 | "gnunet-service-arm", |
461 | #if VERBOSE_ARM | 470 | #if VERBOSE_ARM |
462 | "-L", "DEBUG", | 471 | "-L", "DEBUG", |
463 | #endif | 472 | #endif |
464 | "-c", cfgname, NULL); | 473 | "-c", cfgname, NULL); |
465 | #endif | 474 | #endif |
466 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); | 475 | GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (p->cfg, cfgname)); |
467 | 476 | ||
@@ -482,8 +491,7 @@ run (void *cls, | |||
482 | setup_peer (&p1, "test_dht_api_peer1.conf"); | 491 | setup_peer (&p1, "test_dht_api_peer1.conf"); |
483 | 492 | ||
484 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | 493 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply |
485 | (GNUNET_TIME_UNIT_SECONDS, 1), &test_put, | 494 | (GNUNET_TIME_UNIT_SECONDS, 1), &test_put, &p1); |
486 | &p1); | ||
487 | } | 495 | } |
488 | 496 | ||
489 | static int | 497 | static int |