aboutsummaryrefslogtreecommitdiff
path: root/src/dht/test_dht_monitor.c
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2012-01-05 21:16:52 +0000
committerBart Polot <bart@net.in.tum.de>2012-01-05 21:16:52 +0000
commit3c5c48af5d473594a46903d9cba99c5a20fa5d95 (patch)
tree37e2ccb727bec6c405196e7961c04656a1e25ba3 /src/dht/test_dht_monitor.c
parent70a926d688a41197ef55dbfc874b73539b7b56a1 (diff)
downloadgnunet-3c5c48af5d473594a46903d9cba99c5a20fa5d95.tar.gz
gnunet-3c5c48af5d473594a46903d9cba99c5a20fa5d95.zip
- Improved test to count only relevant messages, completed info transmitted from service
Diffstat (limited to 'src/dht/test_dht_monitor.c')
-rw-r--r--src/dht/test_dht_monitor.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/dht/test_dht_monitor.c b/src/dht/test_dht_monitor.c
index ae1cf3ecf..37e270d92 100644
--- a/src/dht/test_dht_monitor.c
+++ b/src/dht/test_dht_monitor.c
@@ -130,6 +130,8 @@ struct GNUNET_TESTING_Daemon *o;
130 130
131unsigned int monitor_counter; 131unsigned int monitor_counter;
132 132
133int in_test;
134
133/** 135/**
134 * Check whether peers successfully shut down. 136 * Check whether peers successfully shut down.
135 */ 137 */
@@ -241,6 +243,7 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
241static void 243static void
242do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 244do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
243{ 245{
246 in_test = GNUNET_YES;
244 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: test_task\n"); 247 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: test_task\n");
245 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: looking for %s\n", 248 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: looking for %s\n",
246 GNUNET_h2s_full (&d_far->id.hashPubKey)); 249 GNUNET_h2s_full (&d_far->id.hashPubKey));
@@ -308,11 +311,16 @@ monitor_dht_cb (void *cls,
308 const void *data, 311 const void *data,
309 size_t size) 312 size_t size)
310{ 313{
314 const char *s_key;
315
316 s_key = GNUNET_h2s(key);
311 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 317 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
312 "%u got a message of type %u for key %s\n", 318 "%u got a message of type %u for key %s\n",
313 cls, mtype, GNUNET_h2s (key)); 319 cls, mtype, s_key);
314 if (mtype == GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET || 320
315 mtype == GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT) 321 if ((mtype == GNUNET_MESSAGE_TYPE_DHT_MONITOR_GET ||
322 mtype == GNUNET_MESSAGE_TYPE_DHT_MONITOR_PUT) &&
323 strncmp (s_key, id_far, 4) == 0 && in_test == GNUNET_YES)
316 monitor_counter++; 324 monitor_counter++;
317} 325}
318 326
@@ -566,6 +574,7 @@ main (int xargc, char *xargv[])
566 NULL 574 NULL
567 }; 575 };
568 576
577 in_test = GNUNET_NO;
569 GNUNET_PROGRAM_run (sizeof (argv) / sizeof (char *) - 1, argv, 578 GNUNET_PROGRAM_run (sizeof (argv) / sizeof (char *) - 1, argv,
570 "test_dht_monitor", 579 "test_dht_monitor",
571 gettext_noop ("Test dht monitoring in a small 2D torus."), 580 gettext_noop ("Test dht monitoring in a small 2D torus."),