HELLOs
authorChristian Grothoff <christian@grothoff.org>
Sat, 13 Aug 2011 21:19:05 +0000 (21:19 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sat, 13 Aug 2011 21:19:05 +0000 (21:19 +0000)
src/transport/gnunet-service-transport-new.c
src/transport/gnunet-service-transport_hello.c
src/transport/gnunet-service-transport_hello.h

index f34450319bb8663f7b593a3ed4c449f50dce9d4b..d0ad2fbad18346b15eb7f4b9b9d335e7cb702c84 100644 (file)
@@ -76,6 +76,30 @@ struct GNUNET_CRYPTO_RsaPrivateKey *GST_my_private_key;
 struct GNUNET_ATS_Handle *GST_ats;
 
 
+/**
+ * Transmit our HELLO message to the given (connected) neighbour.
+ *
+ * @param cls the 'HELLO' message
+ * @param target a connected neighbour
+ * @param ats performance information (unused)
+ * @param ats_count number of records in ats (unused)
+ */
+static void
+transmit_our_hello (void *cls,
+                   const struct GNUNET_PeerIdentity *target,
+                   const struct GNUNET_TRANSPORT_ATS_Information *ats, 
+                   uint32_t ats_count)
+{
+  const struct GNUNET_MessageHeader *hello = cls;
+
+  GST_neighbours_send (target,
+                      (const char*) hello,
+                      ntohs (hello->size),
+                      GST_HELLO_ADDRESS_EXPIRATION,
+                      NULL, NULL);
+}
+
+
 /**
  * My HELLO has changed. Tell everyone who should know.
  *
@@ -87,12 +111,8 @@ process_hello_update (void *cls,
                      const struct GNUNET_MessageHeader *hello)
 {
   GST_clients_broadcast (hello, GNUNET_NO);
-  GNUNET_break (0); // FIXME
-#if 0
-  GNUNET_CONTAINER_multihashmap_iterate (neighbours,
-                                        &transmit_our_hello_if_pong,
-                                        NULL);
-#endif
+  GST_neighbours_iterate (&transmit_our_hello,
+                         (void*) hello);
 }
 
 
index cf74597692be27b6a5fe29e3f536730d0327018f..f05c0836a0aed0b83e61282638c68acdf666b6b1 100644 (file)
 #include "gnunet-service-transport.h"
 #include "gnunet-service-transport_plugins.h"
 
-/**
- * After how long do we expire an address in a HELLO that we just
- * validated?  This value is also used for our own addresses when we
- * create a HELLO.
- */
-#define HELLO_ADDRESS_EXPIRATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 12)
 
 /**
  * How often do we refresh our HELLO (due to expiration concerns)?
@@ -172,7 +166,7 @@ refresh_hello_task (void *cls,
 
   hello_task = GNUNET_SCHEDULER_NO_TASK;
   gc.addr_pos = oal_head;
-  gc.expiration = GNUNET_TIME_relative_to_absolute (HELLO_ADDRESS_EXPIRATION);
+  gc.expiration = GNUNET_TIME_relative_to_absolute (GST_HELLO_ADDRESS_EXPIRATION);
   GNUNET_free (our_hello);
   our_hello = GNUNET_HELLO_create (&GST_my_public_key, 
                                   &address_generator, 
index d341628417ff79942370339873cbddada55b7f28..7b86d62d040519c28d2444a30c97c363e4a6bd55 100644 (file)
 #include "gnunet_util_lib.h"
 
 
+/**
+ * After how long do we expire an address in a HELLO that we just
+ * validated?  This value is also used for our own addresses when we
+ * create a HELLO.
+ */
+#define GST_HELLO_ADDRESS_EXPIRATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 12)
+
+
 /**
  * Signature of a function to call whenever our hello changes.
  *