aboutsummaryrefslogtreecommitdiff
path: root/src/dht
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-06-19 06:57:21 +0000
committerChristian Grothoff <christian@grothoff.org>2012-06-19 06:57:21 +0000
commitf76715492c7f4c0061a74f3491c220ef9a322a8e (patch)
tree66195ac9907d772189fd0f70f812dafad8d84534 /src/dht
parent5dce96eeb4522e1ee1915f929dd180e1756c9e4a (diff)
downloadgnunet-f76715492c7f4c0061a74f3491c220ef9a322a8e.tar.gz
gnunet-f76715492c7f4c0061a74f3491c220ef9a322a8e.zip
-fixing #2397 -- start put a bit after starting monitoring to observe all events
Diffstat (limited to 'src/dht')
-rw-r--r--src/dht/test_dht_monitor.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/dht/test_dht_monitor.c b/src/dht/test_dht_monitor.c
index 77fa6609d..2a59b9bfa 100644
--- a/src/dht/test_dht_monitor.c
+++ b/src/dht/test_dht_monitor.c
@@ -182,6 +182,7 @@ disconnect_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
182 shutdown_handle = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); 182 shutdown_handle = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
183} 183}
184 184
185
185static void 186static void
186dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp, 187dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
187 const struct GNUNET_HashCode * key, 188 const struct GNUNET_HashCode * key,
@@ -229,6 +230,7 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
229 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_peers, NULL); 230 disconnect_task = GNUNET_SCHEDULER_add_now (&disconnect_peers, NULL);
230} 231}
231 232
233
232/** 234/**
233 * Start test: start GET request from the first node in the line looking for 235 * Start test: start GET request from the first node in the line looking for
234 * the ID of the last node in the line. 236 * the ID of the last node in the line.
@@ -293,6 +295,7 @@ put_id (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
293 put_task = GNUNET_SCHEDULER_add_delayed (PUT_FREQUENCY, &put_id, NULL); 295 put_task = GNUNET_SCHEDULER_add_delayed (PUT_FREQUENCY, &put_id, NULL);
294} 296}
295 297
298
296/** 299/**
297 * Callback called on each GET request going through the DHT. 300 * Callback called on each GET request going through the DHT.
298 * Prints the info about the intercepted packet and increments a counter. 301 * Prints the info about the intercepted packet and increments a counter.
@@ -306,7 +309,7 @@ put_id (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
306 * @param desired_replication_level Desired replication level. 309 * @param desired_replication_level Desired replication level.
307 * @param key Key of the requested data. 310 * @param key Key of the requested data.
308 */ 311 */
309void 312static void
310monitor_get_cb (void *cls, 313monitor_get_cb (void *cls,
311 enum GNUNET_DHT_RouteOption options, 314 enum GNUNET_DHT_RouteOption options,
312 enum GNUNET_BLOCK_Type type, 315 enum GNUNET_BLOCK_Type type,
@@ -346,7 +349,7 @@ monitor_get_cb (void *cls,
346 * @param data Pointer to the data carried. 349 * @param data Pointer to the data carried.
347 * @param size Number of bytes in data. 350 * @param size Number of bytes in data.
348 */ 351 */
349void 352static void
350monitor_put_cb (void *cls, 353monitor_put_cb (void *cls,
351 enum GNUNET_DHT_RouteOption options, 354 enum GNUNET_DHT_RouteOption options,
352 enum GNUNET_BLOCK_Type type, 355 enum GNUNET_BLOCK_Type type,
@@ -389,7 +392,7 @@ monitor_put_cb (void *cls,
389 * @param data Pointer to the result data. 392 * @param data Pointer to the result data.
390 * @param size Number of bytes in data. 393 * @param size Number of bytes in data.
391 */ 394 */
392void 395static void
393monitor_res_cb (void *cls, 396monitor_res_cb (void *cls,
394 enum GNUNET_BLOCK_Type type, 397 enum GNUNET_BLOCK_Type type,
395 const struct GNUNET_PeerIdentity *get_path, 398 const struct GNUNET_PeerIdentity *get_path,
@@ -481,10 +484,11 @@ peergroup_ready (void *cls, const char *emsg)
481 return; 484 return;
482 } 485 }
483 monitor_counter = 0; 486 monitor_counter = 0;
484 put_task = GNUNET_SCHEDULER_add_now (&put_id, NULL); 487 put_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
488 &put_id, NULL);
485 test_task = 489 test_task =
486 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply 490 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
487 (GNUNET_TIME_UNIT_SECONDS, 2), &do_test, 491 (GNUNET_TIME_UNIT_SECONDS, 3), &do_test,
488 NULL); 492 NULL);
489 disconnect_task = 493 disconnect_task =
490 GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT, &disconnect_peers, NULL); 494 GNUNET_SCHEDULER_add_delayed (GET_TIMEOUT, &disconnect_peers, NULL);