gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r25039 - in gnunet/src: dht transport


From: gnunet
Subject: [GNUnet-SVN] r25039 - in gnunet/src: dht transport
Date: Sun, 18 Nov 2012 19:09:32 +0100

Author: tg
Date: 2012-11-18 19:09:32 +0100 (Sun, 18 Nov 2012)
New Revision: 25039

Modified:
   gnunet/src/dht/gnunet-service-dht.c
   gnunet/src/dht/gnunet-service-dht_neighbours.c
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/gnunet-service-transport_hello.c
Log:
configurable hello expiration

Modified: gnunet/src/dht/gnunet-service-dht.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht.c 2012-11-18 18:09:29 UTC (rev 25038)
+++ gnunet/src/dht/gnunet-service-dht.c 2012-11-18 18:09:32 UTC (rev 25039)
@@ -66,13 +66,17 @@
  */
 struct GNUNET_TRANSPORT_Handle *GDS_transport_handle;
 
-
 /**
  * Handle to get our current HELLO.
  */
 static struct GNUNET_TRANSPORT_GetHelloHandle *ghh;
 
+/**
+ * Hello address expiration
+ */
+struct GNUNET_TIME_Relative hello_expiration;
 
+
 /**
  * Receive the HELLO from transport service, free current and replace
  * if necessary.
@@ -141,6 +145,11 @@
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
   GDS_cfg = c;
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_time (c, "transport", "HELLO_EXPIRATION", 
&hello_expiration))
+  {
+    hello_expiration = GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION;
+  }
   GDS_block_context = GNUNET_BLOCK_context_create (GDS_cfg);
   GDS_stats = GNUNET_STATISTICS_create ("dht", GDS_cfg);
   GDS_ROUTING_init ();

Modified: gnunet/src/dht/gnunet-service-dht_neighbours.c
===================================================================
--- gnunet/src/dht/gnunet-service-dht_neighbours.c      2012-11-18 18:09:29 UTC 
(rev 25038)
+++ gnunet/src/dht/gnunet-service-dht_neighbours.c      2012-11-18 18:09:32 UTC 
(rev 25039)
@@ -100,6 +100,12 @@
 #define LOG_ROUTE_DETAILS_STDERR GNUNET_NO
 
 
+/**
+ * Hello address expiration
+ */
+extern struct GNUNET_TIME_Relative hello_expiration;
+
+
 GNUNET_NETWORK_STRUCT_BEGIN
 
 /**
@@ -1683,7 +1689,7 @@
     {
       GDS_NEIGHBOURS_handle_reply (sender, GNUNET_BLOCK_TYPE_DHT_HELLO,
                                    GNUNET_TIME_relative_to_absolute
-                                   (GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION),
+                                   (hello_expiration),
                                    key, 0, NULL, 0, NULL, GDS_my_hello,
                                    GNUNET_HELLO_size ((const struct
                                                        GNUNET_HELLO_Message *)

Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2012-11-18 18:09:29 UTC 
(rev 25038)
+++ gnunet/src/transport/gnunet-service-transport.c     2012-11-18 18:09:32 UTC 
(rev 25039)
@@ -91,7 +91,12 @@
  */
 static int connections;
 
+/**
+ * Hello address expiration
+ */
+struct GNUNET_TIME_Relative hello_expiration;
 
+
 /**
  * Transmit our HELLO message to the given (connected) neighbour.
  *
@@ -114,7 +119,7 @@
   const struct GNUNET_MessageHeader *hello = cls;
 
   GST_neighbours_send (target, (const char *) hello, ntohs (hello->size),
-                       GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION, NULL, NULL);
+                       hello_expiration, NULL, NULL);
 }
 
 
@@ -675,6 +680,12 @@
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_time (c, "transport", "HELLO_EXPIRATION",
+                                           &hello_expiration))
+  {
+    hello_expiration = GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION;
+  }
   GST_server = server;
   GNUNET_SERVER_suspend (server);
   GST_keygen = GNUNET_CRYPTO_rsa_key_create_start (keyfile, 
&key_generation_cb, NULL);

Modified: gnunet/src/transport/gnunet-service-transport_hello.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_hello.c       2012-11-18 
18:09:29 UTC (rev 25038)
+++ gnunet/src/transport/gnunet-service-transport_hello.c       2012-11-18 
18:09:32 UTC (rev 25039)
@@ -38,7 +38,12 @@
  */
 #define HELLO_REFRESH_PERIOD GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_HOURS, 6)
 
+/**
+ * Hello address expiration
+ */
+extern struct GNUNET_TIME_Relative hello_expiration;
 
+
 /**
  * Entry in linked list of network addresses for ourselves.  Also
  * includes a cached signature for 'struct TransportPongMessage's.
@@ -159,9 +164,7 @@
 
   hello_task = GNUNET_SCHEDULER_NO_TASK;
   gc.addr_pos = oal_head;
-  gc.expiration =
-      GNUNET_TIME_relative_to_absolute
-      (GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION);
+  gc.expiration = GNUNET_TIME_relative_to_absolute (hello_expiration);
 
   GNUNET_free (our_hello);
   our_hello = GNUNET_HELLO_create (&GST_my_public_key, &address_generator, 
&gc);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]