aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2012-11-18 18:09:32 +0000
committerGabor X Toth <*@tg-x.net>2012-11-18 18:09:32 +0000
commitff6b5bb3cfeeaaf353bf734c09619c4adbd02ee6 (patch)
treee5e96be6a02776d9dc5de475c8bca7d471a696b5 /src
parent33bc21c1a116c35b0bea87b09b18ce2683c7e16b (diff)
downloadgnunet-ff6b5bb3cfeeaaf353bf734c09619c4adbd02ee6.tar.gz
gnunet-ff6b5bb3cfeeaaf353bf734c09619c4adbd02ee6.zip
configurable hello expiration
Diffstat (limited to 'src')
-rw-r--r--src/dht/gnunet-service-dht.c11
-rw-r--r--src/dht/gnunet-service-dht_neighbours.c8
-rw-r--r--src/transport/gnunet-service-transport.c13
-rw-r--r--src/transport/gnunet-service-transport_hello.c9
4 files changed, 35 insertions, 6 deletions
diff --git a/src/dht/gnunet-service-dht.c b/src/dht/gnunet-service-dht.c
index 72575acae..5efa9ddc6 100644
--- a/src/dht/gnunet-service-dht.c
+++ b/src/dht/gnunet-service-dht.c
@@ -66,12 +66,16 @@ struct GNUNET_MessageHeader *GDS_my_hello;
66 */ 66 */
67struct GNUNET_TRANSPORT_Handle *GDS_transport_handle; 67struct GNUNET_TRANSPORT_Handle *GDS_transport_handle;
68 68
69
70/** 69/**
71 * Handle to get our current HELLO. 70 * Handle to get our current HELLO.
72 */ 71 */
73static struct GNUNET_TRANSPORT_GetHelloHandle *ghh; 72static struct GNUNET_TRANSPORT_GetHelloHandle *ghh;
74 73
74/**
75 * Hello address expiration
76 */
77struct GNUNET_TIME_Relative hello_expiration;
78
75 79
76/** 80/**
77 * Receive the HELLO from transport service, free current and replace 81 * Receive the HELLO from transport service, free current and replace
@@ -141,6 +145,11 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
141 const struct GNUNET_CONFIGURATION_Handle *c) 145 const struct GNUNET_CONFIGURATION_Handle *c)
142{ 146{
143 GDS_cfg = c; 147 GDS_cfg = c;
148 if (GNUNET_OK !=
149 GNUNET_CONFIGURATION_get_value_time (c, "transport", "HELLO_EXPIRATION", &hello_expiration))
150 {
151 hello_expiration = GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION;
152 }
144 GDS_block_context = GNUNET_BLOCK_context_create (GDS_cfg); 153 GDS_block_context = GNUNET_BLOCK_context_create (GDS_cfg);
145 GDS_stats = GNUNET_STATISTICS_create ("dht", GDS_cfg); 154 GDS_stats = GNUNET_STATISTICS_create ("dht", GDS_cfg);
146 GDS_ROUTING_init (); 155 GDS_ROUTING_init ();
diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c
index 40b1013f3..4872b58a5 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -100,6 +100,12 @@
100#define LOG_ROUTE_DETAILS_STDERR GNUNET_NO 100#define LOG_ROUTE_DETAILS_STDERR GNUNET_NO
101 101
102 102
103/**
104 * Hello address expiration
105 */
106extern struct GNUNET_TIME_Relative hello_expiration;
107
108
103GNUNET_NETWORK_STRUCT_BEGIN 109GNUNET_NETWORK_STRUCT_BEGIN
104 110
105/** 111/**
@@ -1683,7 +1689,7 @@ handle_find_peer (const struct GNUNET_PeerIdentity *sender,
1683 { 1689 {
1684 GDS_NEIGHBOURS_handle_reply (sender, GNUNET_BLOCK_TYPE_DHT_HELLO, 1690 GDS_NEIGHBOURS_handle_reply (sender, GNUNET_BLOCK_TYPE_DHT_HELLO,
1685 GNUNET_TIME_relative_to_absolute 1691 GNUNET_TIME_relative_to_absolute
1686 (GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION), 1692 (hello_expiration),
1687 key, 0, NULL, 0, NULL, GDS_my_hello, 1693 key, 0, NULL, 0, NULL, GDS_my_hello,
1688 GNUNET_HELLO_size ((const struct 1694 GNUNET_HELLO_size ((const struct
1689 GNUNET_HELLO_Message *) 1695 GNUNET_HELLO_Message *)
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index da6812c96..0b596d021 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -91,6 +91,11 @@ struct GNUNET_ATS_SchedulingHandle *GST_ats;
91 */ 91 */
92static int connections; 92static int connections;
93 93
94/**
95 * Hello address expiration
96 */
97struct GNUNET_TIME_Relative hello_expiration;
98
94 99
95/** 100/**
96 * Transmit our HELLO message to the given (connected) neighbour. 101 * Transmit our HELLO message to the given (connected) neighbour.
@@ -114,7 +119,7 @@ transmit_our_hello (void *cls, const struct GNUNET_PeerIdentity *target,
114 const struct GNUNET_MessageHeader *hello = cls; 119 const struct GNUNET_MessageHeader *hello = cls;
115 120
116 GST_neighbours_send (target, (const char *) hello, ntohs (hello->size), 121 GST_neighbours_send (target, (const char *) hello, ntohs (hello->size),
117 GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION, NULL, NULL); 122 hello_expiration, NULL, NULL);
118} 123}
119 124
120 125
@@ -675,6 +680,12 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
675 GNUNET_SCHEDULER_shutdown (); 680 GNUNET_SCHEDULER_shutdown ();
676 return; 681 return;
677 } 682 }
683 if (GNUNET_OK !=
684 GNUNET_CONFIGURATION_get_value_time (c, "transport", "HELLO_EXPIRATION",
685 &hello_expiration))
686 {
687 hello_expiration = GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION;
688 }
678 GST_server = server; 689 GST_server = server;
679 GNUNET_SERVER_suspend (server); 690 GNUNET_SERVER_suspend (server);
680 GST_keygen = GNUNET_CRYPTO_rsa_key_create_start (keyfile, &key_generation_cb, NULL); 691 GST_keygen = GNUNET_CRYPTO_rsa_key_create_start (keyfile, &key_generation_cb, NULL);
diff --git a/src/transport/gnunet-service-transport_hello.c b/src/transport/gnunet-service-transport_hello.c
index 870c083d2..247fbc882 100644
--- a/src/transport/gnunet-service-transport_hello.c
+++ b/src/transport/gnunet-service-transport_hello.c
@@ -38,6 +38,11 @@
38 */ 38 */
39#define HELLO_REFRESH_PERIOD GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 6) 39#define HELLO_REFRESH_PERIOD GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 6)
40 40
41/**
42 * Hello address expiration
43 */
44extern struct GNUNET_TIME_Relative hello_expiration;
45
41 46
42/** 47/**
43 * Entry in linked list of network addresses for ourselves. Also 48 * Entry in linked list of network addresses for ourselves. Also
@@ -159,9 +164,7 @@ refresh_hello_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
159 164
160 hello_task = GNUNET_SCHEDULER_NO_TASK; 165 hello_task = GNUNET_SCHEDULER_NO_TASK;
161 gc.addr_pos = oal_head; 166 gc.addr_pos = oal_head;
162 gc.expiration = 167 gc.expiration = GNUNET_TIME_relative_to_absolute (hello_expiration);
163 GNUNET_TIME_relative_to_absolute
164 (GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION);
165 168
166 GNUNET_free (our_hello); 169 GNUNET_free (our_hello);
167 our_hello = GNUNET_HELLO_create (&GST_my_public_key, &address_generator, &gc); 170 our_hello = GNUNET_HELLO_create (&GST_my_public_key, &address_generator, &gc);