diff options
author | Nathan S. Evans <evans@in.tum.de> | 2011-11-19 19:08:37 +0000 |
---|---|---|
committer | Nathan S. Evans <evans@in.tum.de> | 2011-11-19 19:08:37 +0000 |
commit | dbaa827eaaeded675980aa2f8f8af87f82923df6 (patch) | |
tree | ca8057e0245147461abc350421e50c01036aedd1 /src/dv | |
parent | c5e920135215aa0b59839c2d42190b99214dca24 (diff) | |
download | gnunet-dbaa827eaaeded675980aa2f8f8af87f82923df6.tar.gz gnunet-dbaa827eaaeded675980aa2f8f8af87f82923df6.zip |
debugging dv/transport problems
Diffstat (limited to 'src/dv')
-rw-r--r-- | src/dv/plugin_transport_dv.c | 12 | ||||
-rw-r--r-- | src/dv/test_transport_api_dv.c | 66 | ||||
-rw-r--r-- | src/dv/test_transport_dv_data.conf | 4 |
3 files changed, 45 insertions, 37 deletions
diff --git a/src/dv/plugin_transport_dv.c b/src/dv/plugin_transport_dv.c index 6b585f6cc..569213f72 100644 --- a/src/dv/plugin_transport_dv.c +++ b/src/dv/plugin_transport_dv.c | |||
@@ -160,18 +160,21 @@ handle_dv_message_received (void *cls, struct GNUNET_PeerIdentity *sender, | |||
160 | my_id, GNUNET_i2s (sender), | 160 | my_id, GNUNET_i2s (sender), |
161 | ntohs (((struct GNUNET_MessageHeader *) msg)->type), | 161 | ntohs (((struct GNUNET_MessageHeader *) msg)->type), |
162 | distance); | 162 | distance); |
163 | if (sender_address_len == (2 * sizeof(struct GNUNET_PeerIdentity))) | ||
164 | { | ||
165 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "plugin_transport_dv", "Parsed sender address: %s:%s\n", GNUNET_i2s((struct GNUNET_PeerIdentity *)sender_address), GNUNET_h2s(&((struct GNUNET_PeerIdentity *)&sender_address[sizeof(struct GNUNET_PeerIdentity)])->hashPubKey)); | ||
166 | } | ||
167 | |||
163 | GNUNET_free_non_null (my_id); | 168 | GNUNET_free_non_null (my_id); |
164 | #endif | 169 | #endif |
165 | struct GNUNET_ATS_Information ats[2]; | 170 | struct GNUNET_ATS_Information ats[1]; |
166 | 171 | ||
167 | ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); | 172 | ats[0].type = htonl (GNUNET_ATS_QUALITY_NET_DISTANCE); |
168 | ats[0].value = htonl (distance); | 173 | ats[0].value = htonl (distance); |
169 | ats[1].type = htonl (GNUNET_ATS_ARRAY_TERMINATOR); | ||
170 | ats[1].value = htonl (0); | ||
171 | 174 | ||
172 | plugin->env->receive (plugin->env->cls, sender, | 175 | plugin->env->receive (plugin->env->cls, sender, |
173 | (struct GNUNET_MessageHeader *) msg, | 176 | (struct GNUNET_MessageHeader *) msg, |
174 | (const struct GNUNET_ATS_Information *) &ats, 2, NULL, | 177 | (const struct GNUNET_ATS_Information *) &ats, 1, NULL, |
175 | sender_address, sender_address_len); | 178 | sender_address, sender_address_len); |
176 | 179 | ||
177 | } | 180 | } |
@@ -367,6 +370,7 @@ dv_plugin_check_address (void *cls, const void *addr, size_t addrlen) | |||
367 | } | 370 | } |
368 | return GNUNET_SYSERR; | 371 | return GNUNET_SYSERR; |
369 | } | 372 | } |
373 | |||
370 | return GNUNET_OK; | 374 | return GNUNET_OK; |
371 | } | 375 | } |
372 | 376 | ||
diff --git a/src/dv/test_transport_api_dv.c b/src/dv/test_transport_api_dv.c index 0a3bbaa51..5f40fb522 100644 --- a/src/dv/test_transport_api_dv.c +++ b/src/dv/test_transport_api_dv.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "gnunet_testing_lib.h" | 25 | #include "gnunet_testing_lib.h" |
26 | #include "gnunet_core_service.h" | 26 | #include "gnunet_core_service.h" |
27 | 27 | ||
28 | #define VERBOSE GNUNET_EXTRA_LOGGING | 28 | #define VERBOSE 1 |
29 | 29 | ||
30 | #define TEST_ALL GNUNET_NO | 30 | #define TEST_ALL GNUNET_NO |
31 | 31 | ||
@@ -394,24 +394,28 @@ send_other_messages (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc); | |||
394 | * @return connected transport distance | 394 | * @return connected transport distance |
395 | */ | 395 | */ |
396 | static uint32_t | 396 | static uint32_t |
397 | get_atsi_distance (const struct GNUNET_ATS_Information *atsi) | 397 | get_atsi_distance (const struct GNUNET_ATS_Information *atsi, unsigned int atsi_count) |
398 | { | 398 | { |
399 | while ((ntohl (atsi->type) != GNUNET_ATS_ARRAY_TERMINATOR) && | 399 | unsigned int i; |
400 | (ntohl (atsi->type) != GNUNET_ATS_QUALITY_NET_DISTANCE)) | 400 | |
401 | atsi++; | 401 | for (i = 0; i < atsi_count; i++) |
402 | if (ntohl (atsi->type) == GNUNET_ATS_ARRAY_TERMINATOR) | 402 | { |
403 | { | 403 | if (ntohl (atsi->type) == GNUNET_ATS_QUALITY_NET_DISTANCE) |
404 | GNUNET_break (0); | 404 | return ntohl (atsi->value); |
405 | /* FIXME: we do not have distance data? Assume direct neighbor. */ | 405 | } |
406 | return 1; | 406 | |
407 | } | 407 | GNUNET_break (0); |
408 | return ntohl (atsi->value); | 408 | /* FIXME: we do not have distance data? Assume direct neighbor. */ |
409 | return 1; | ||
409 | } | 410 | } |
410 | 411 | ||
412 | |||
411 | static int | 413 | static int |
412 | process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer, | 414 | process_mtype (void *cls, |
415 | const struct GNUNET_PeerIdentity *peer, | ||
413 | const struct GNUNET_MessageHeader *message, | 416 | const struct GNUNET_MessageHeader *message, |
414 | const struct GNUNET_ATS_Information *atsi) | 417 | const struct GNUNET_ATS_Information *atsi, |
418 | unsigned int atsi_count) | ||
415 | { | 419 | { |
416 | struct TestMessageContext *pos = cls; | 420 | struct TestMessageContext *pos = cls; |
417 | struct GNUNET_TestMessage *msg = (struct GNUNET_TestMessage *) message; | 421 | struct GNUNET_TestMessage *msg = (struct GNUNET_TestMessage *) message; |
@@ -423,7 +427,7 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
423 | return GNUNET_OK; | 427 | return GNUNET_OK; |
424 | 428 | ||
425 | #if VERBOSE | 429 | #if VERBOSE |
426 | distance = get_atsi_distance (atsi); | 430 | distance = get_atsi_distance (atsi, atsi_count); |
427 | #endif | 431 | #endif |
428 | GNUNET_assert (0 == | 432 | GNUNET_assert (0 == |
429 | memcmp (peer, &pos->peer1->id, | 433 | memcmp (peer, &pos->peer1->id, |
@@ -450,7 +454,7 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
450 | GNUNET_i2s (peer), ntohs (message->type), ntohl (msg->uid), | 454 | GNUNET_i2s (peer), ntohs (message->type), ntohl (msg->uid), |
451 | distance); | 455 | distance); |
452 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 456 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
453 | "Total messages received %d, expected %d.\n", | 457 | "Total OTHER messages received %d, expected %d.\n", |
454 | total_other_messages, total_other_expected_messages); | 458 | total_other_messages, total_other_expected_messages); |
455 | #endif | 459 | #endif |
456 | } | 460 | } |
@@ -459,18 +463,12 @@ process_mtype (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
459 | (total_other_messages == 0)) | 463 | (total_other_messages == 0)) |
460 | { | 464 | { |
461 | GNUNET_SCHEDULER_cancel (die_task); | 465 | GNUNET_SCHEDULER_cancel (die_task); |
466 | #if VERBOSE | ||
467 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Scheduling timeout from DV connections.\n"); | ||
468 | #endif | ||
462 | die_task = | 469 | die_task = |
463 | GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT, &end_badly, | 470 | GNUNET_SCHEDULER_add_delayed (TEST_TIMEOUT, &end_badly, |
464 | "waiting for DV peers to connect!"); | 471 | "waiting for DV peers to connect!"); |
465 | /* | ||
466 | * if ((num_peers == 3) && (total_other_expected_messages == 2)) | ||
467 | * { | ||
468 | * GNUNET_SCHEDULER_add_now (&send_other_messages, NULL); | ||
469 | * } | ||
470 | * else | ||
471 | * { | ||
472 | * GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 20), &send_other_messages, NULL); | ||
473 | * } */ | ||
474 | } | 472 | } |
475 | else if ((total_other_expected_messages > 0) && | 473 | else if ((total_other_expected_messages > 0) && |
476 | (total_other_messages == total_other_expected_messages)) | 474 | (total_other_messages == total_other_expected_messages)) |
@@ -524,10 +522,12 @@ static struct GNUNET_CORE_MessageHandler handlers[] = { | |||
524 | * @param cls closure | 522 | * @param cls closure |
525 | * @param peer peer identity this notification is about | 523 | * @param peer peer identity this notification is about |
526 | * @param atsi performance data for the connection | 524 | * @param atsi performance data for the connection |
525 | * @param atsi_count number of ATS information included | ||
527 | */ | 526 | */ |
528 | static void | 527 | static void |
529 | connect_notify_peer2 (void *cls, const struct GNUNET_PeerIdentity *peer, | 528 | connect_notify_peer2 (void *cls, const struct GNUNET_PeerIdentity *peer, |
530 | const struct GNUNET_ATS_Information *atsi) | 529 | const struct GNUNET_ATS_Information *atsi, |
530 | unsigned int atsi_count) | ||
531 | { | 531 | { |
532 | struct TestMessageContext *pos = cls; | 532 | struct TestMessageContext *pos = cls; |
533 | 533 | ||
@@ -577,10 +577,12 @@ init_notify_peer2 (void *cls, struct GNUNET_CORE_Handle *server, | |||
577 | * @param cls closure | 577 | * @param cls closure |
578 | * @param peer peer identity this notification is about | 578 | * @param peer peer identity this notification is about |
579 | * @param atsi performance data for the connection | 579 | * @param atsi performance data for the connection |
580 | * @param atsi_count number of atsi datums | ||
580 | */ | 581 | */ |
581 | static void | 582 | static void |
582 | connect_notify_peer1 (void *cls, const struct GNUNET_PeerIdentity *peer, | 583 | connect_notify_peer1 (void *cls, const struct GNUNET_PeerIdentity *peer, |
583 | const struct GNUNET_ATS_Information *atsi) | 584 | const struct GNUNET_ATS_Information *atsi, |
585 | unsigned int atsi_count) | ||
584 | { | 586 | { |
585 | struct TestMessageContext *pos = cls; | 587 | struct TestMessageContext *pos = cls; |
586 | 588 | ||
@@ -835,12 +837,14 @@ topology_callback (void *cls, const struct GNUNET_PeerIdentity *first, | |||
835 | * | 837 | * |
836 | * @param cls closure | 838 | * @param cls closure |
837 | * @param peer peer identity this notification is about | 839 | * @param peer peer identity this notification is about |
838 | * @param latency reported latency of the connection with 'other' | 840 | * @param atsi performance data about this peer's connection |
839 | * @param distance reported distance (DV) to 'other' | 841 | * @param atsi_count number of atsi datums |
842 | * | ||
840 | */ | 843 | */ |
841 | static void | 844 | static void |
842 | all_connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer, | 845 | all_connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer, |
843 | const struct GNUNET_ATS_Information *atsi) | 846 | const struct GNUNET_ATS_Information *atsi, |
847 | unsigned int atsi_count) | ||
844 | { | 848 | { |
845 | struct GNUNET_TESTING_Daemon *d = cls; | 849 | struct GNUNET_TESTING_Daemon *d = cls; |
846 | struct GNUNET_TESTING_Daemon *second_daemon; | 850 | struct GNUNET_TESTING_Daemon *second_daemon; |
@@ -854,7 +858,7 @@ all_connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
854 | if (0 == memcmp (&d->id, peer, sizeof (struct GNUNET_PeerIdentity))) | 858 | if (0 == memcmp (&d->id, peer, sizeof (struct GNUNET_PeerIdentity))) |
855 | return; | 859 | return; |
856 | second_shortname = GNUNET_strdup (GNUNET_i2s (peer)); | 860 | second_shortname = GNUNET_strdup (GNUNET_i2s (peer)); |
857 | distance = get_atsi_distance (atsi); | 861 | distance = get_atsi_distance (atsi, atsi_count); |
858 | 862 | ||
859 | #if VERBOSE | 863 | #if VERBOSE |
860 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 864 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
diff --git a/src/dv/test_transport_dv_data.conf b/src/dv/test_transport_dv_data.conf index 5eb2b6c1c..80eb87329 100644 --- a/src/dv/test_transport_dv_data.conf +++ b/src/dv/test_transport_dv_data.conf | |||
@@ -6,7 +6,7 @@ DEFAULTCONFIG = test_transport_dv_data.conf | |||
6 | PORT = 2564 | 6 | PORT = 2564 |
7 | 7 | ||
8 | [transport] | 8 | [transport] |
9 | DEBUG = NO | 9 | DEBUG = YES |
10 | PORT = 2565 | 10 | PORT = 2565 |
11 | PLUGINS = tcp dv | 11 | PLUGINS = tcp dv |
12 | BLACKLIST_FILE = $SERVICEHOME/blacklist | 12 | BLACKLIST_FILE = $SERVICEHOME/blacklist |
@@ -45,7 +45,7 @@ HOSTNAME = localhost | |||
45 | PORT = 2571 | 45 | PORT = 2571 |
46 | 46 | ||
47 | [testing] | 47 | [testing] |
48 | NUM_PEERS = 5 | 48 | NUM_PEERS = 3 |
49 | ADDITIONAL_MESSAGES = 10 | 49 | ADDITIONAL_MESSAGES = 10 |
50 | DEBUG = NO | 50 | DEBUG = NO |
51 | WEAKRANDOM = YES | 51 | WEAKRANDOM = YES |