[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r15834 - gnunet/src/testing
From: |
gnunet |
Subject: |
[GNUnet-SVN] r15834 - gnunet/src/testing |
Date: |
Mon, 4 Jul 2011 11:24:12 +0200 |
Author: grothoff
Date: 2011-07-04 11:24:12 +0200 (Mon, 04 Jul 2011)
New Revision: 15834
Modified:
gnunet/src/testing/testing.c
Log:
hack for empty HELLOs
Modified: gnunet/src/testing/testing.c
===================================================================
--- gnunet/src/testing/testing.c 2011-07-04 09:02:34 UTC (rev 15833)
+++ gnunet/src/testing/testing.c 2011-07-04 09:24:12 UTC (rev 15834)
@@ -38,10 +38,20 @@
#include "gnunet_hello_lib.h"
#define DEBUG_TESTING GNUNET_NO
-#define DEBUG_TESTING_RECONNECT GNUNET_YES
+
+#define DEBUG_TESTING_RECONNECT GNUNET_NO
+
#define WAIT_FOR_HELLO GNUNET_NO
/**
+ * Hack to deal with initial HELLO's being often devoid of addresses.
+ * This hack causes 'process_hello' to ignore HELLOs without addresses.
+ * The correct implementation would continue with 'process_hello' until
+ * the connection could be established...
+ */
+#define EMPTY_HACK GNUNET_YES
+
+/**
* How long do we wait after starting gnunet-service-arm
* for the core service to be alive?
*/
@@ -55,6 +65,20 @@
static struct GNUNET_CORE_MessageHandler no_handlers[] = { {NULL, 0, 0} };
+#if EMPTY_HACK
+static int
+test_address (void *cls,
+ const char *tname,
+ struct GNUNET_TIME_Absolute expiration,
+ const void *addr,
+ uint16_t addrlen)
+{
+ int *empty = cls;
+ *empty = GNUNET_NO;
+ return GNUNET_OK;
+}
+#endif
+
/**
* Receive the HELLO from one peer, give it to the other
* and ask them to connect.
@@ -67,11 +91,27 @@
const struct GNUNET_MessageHeader *message)
{
struct GNUNET_TESTING_Daemon *daemon = cls;
+ int msize;
#if WAIT_FOR_HELLO
GNUNET_TESTING_NotifyDaemonRunning cb;
#endif
+#if EMPTY_HACK
+ int empty;
- int msize;
+ empty = GNUNET_YES;
+ GNUNET_HELLO_iterate_addresses ((const struct GNUNET_HELLO_Message*) message,
+ GNUNET_NO,
+ &test_address,
+ &empty);
+ if (GNUNET_YES == empty)
+ {
+#if DEBUG_TESTING
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Skipping empty HELLO address\n");
+#endif
+ return;
+ }
+#endif
if (daemon == NULL)
return;
@@ -702,7 +742,7 @@
#endif
GNUNET_TRANSPORT_get_hello (d->th, &process_hello, d);
- GNUNET_SCHEDULER_add_now(¬ify_daemon_started, d);
+ GNUNET_SCHEDULER_add_now (¬ify_daemon_started, d);
/*cb = d->cb;
d->cb = NULL;
if (NULL != cb)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r15834 - gnunet/src/testing,
gnunet <=