aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-07-04 09:24:12 +0000
committerChristian Grothoff <christian@grothoff.org>2011-07-04 09:24:12 +0000
commite13aabefe95b69d80136529b365316bb672edb69 (patch)
tree745274c65f1ec0cfe620e2d0e74a73b1acacd322
parent41761e1245f6879b9c990e915bd3279d59d353fe (diff)
downloadgnunet-e13aabefe95b69d80136529b365316bb672edb69.tar.gz
gnunet-e13aabefe95b69d80136529b365316bb672edb69.zip
hack for empty HELLOs
-rw-r--r--src/testing/testing.c48
1 files changed, 44 insertions, 4 deletions
diff --git a/src/testing/testing.c b/src/testing/testing.c
index 78bc99ae4..21014db9f 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -38,10 +38,20 @@
38#include "gnunet_hello_lib.h" 38#include "gnunet_hello_lib.h"
39 39
40#define DEBUG_TESTING GNUNET_NO 40#define DEBUG_TESTING GNUNET_NO
41#define DEBUG_TESTING_RECONNECT GNUNET_YES 41
42#define DEBUG_TESTING_RECONNECT GNUNET_NO
43
42#define WAIT_FOR_HELLO GNUNET_NO 44#define WAIT_FOR_HELLO GNUNET_NO
43 45
44/** 46/**
47 * Hack to deal with initial HELLO's being often devoid of addresses.
48 * This hack causes 'process_hello' to ignore HELLOs without addresses.
49 * The correct implementation would continue with 'process_hello' until
50 * the connection could be established...
51 */
52#define EMPTY_HACK GNUNET_YES
53
54/**
45 * How long do we wait after starting gnunet-service-arm 55 * How long do we wait after starting gnunet-service-arm
46 * for the core service to be alive? 56 * for the core service to be alive?
47 */ 57 */
@@ -55,6 +65,20 @@
55 65
56static struct GNUNET_CORE_MessageHandler no_handlers[] = { {NULL, 0, 0} }; 66static struct GNUNET_CORE_MessageHandler no_handlers[] = { {NULL, 0, 0} };
57 67
68#if EMPTY_HACK
69static int
70test_address (void *cls,
71 const char *tname,
72 struct GNUNET_TIME_Absolute expiration,
73 const void *addr,
74 uint16_t addrlen)
75{
76 int *empty = cls;
77 *empty = GNUNET_NO;
78 return GNUNET_OK;
79}
80#endif
81
58/** 82/**
59 * Receive the HELLO from one peer, give it to the other 83 * Receive the HELLO from one peer, give it to the other
60 * and ask them to connect. 84 * and ask them to connect.
@@ -67,11 +91,27 @@ process_hello (void *cls,
67 const struct GNUNET_MessageHeader *message) 91 const struct GNUNET_MessageHeader *message)
68{ 92{
69 struct GNUNET_TESTING_Daemon *daemon = cls; 93 struct GNUNET_TESTING_Daemon *daemon = cls;
94 int msize;
70#if WAIT_FOR_HELLO 95#if WAIT_FOR_HELLO
71 GNUNET_TESTING_NotifyDaemonRunning cb; 96 GNUNET_TESTING_NotifyDaemonRunning cb;
72#endif 97#endif
73 98#if EMPTY_HACK
74 int msize; 99 int empty;
100
101 empty = GNUNET_YES;
102 GNUNET_HELLO_iterate_addresses ((const struct GNUNET_HELLO_Message*) message,
103 GNUNET_NO,
104 &test_address,
105 &empty);
106 if (GNUNET_YES == empty)
107 {
108#if DEBUG_TESTING
109 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
110 "Skipping empty HELLO address\n");
111#endif
112 return;
113 }
114#endif
75 if (daemon == NULL) 115 if (daemon == NULL)
76 return; 116 return;
77 117
@@ -702,7 +742,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
702#endif 742#endif
703 743
704 GNUNET_TRANSPORT_get_hello (d->th, &process_hello, d); 744 GNUNET_TRANSPORT_get_hello (d->th, &process_hello, d);
705 GNUNET_SCHEDULER_add_now(&notify_daemon_started, d); 745 GNUNET_SCHEDULER_add_now (&notify_daemon_started, d);
706 /*cb = d->cb; 746 /*cb = d->cb;
707 d->cb = NULL; 747 d->cb = NULL;
708 if (NULL != cb) 748 if (NULL != cb)