aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cadet/gnunet-service-cadet_dht.c11
-rw-r--r--src/fs/gnunet-service-fs.c39
-rw-r--r--src/fs/gnunet-service-fs.h1
3 files changed, 5 insertions, 46 deletions
diff --git a/src/cadet/gnunet-service-cadet_dht.c b/src/cadet/gnunet-service-cadet_dht.c
index 576753a38..9a8082339 100644
--- a/src/cadet/gnunet-service-cadet_dht.c
+++ b/src/cadet/gnunet-service-cadet_dht.c
@@ -119,7 +119,7 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
119 size_t size, 119 size_t size,
120 const void *data) 120 const void *data)
121{ 121{
122 const struct GNUNET_HELLO_Message *hello = data; 122 const struct GNUNET_MessageHeader *hello = data;
123 123
124 (void) trunc_peer; 124 (void) trunc_peer;
125 GCPP_try_path_from_dht (get_path, 125 GCPP_try_path_from_dht (get_path,
@@ -127,8 +127,7 @@ dht_get_id_handler (void *cls, struct GNUNET_TIME_Absolute exp,
127 put_path, 127 put_path,
128 put_path_length); 128 put_path_length);
129 if ((size >= sizeof(struct GNUNET_HELLO_Message)) && 129 if ((size >= sizeof(struct GNUNET_HELLO_Message)) &&
130 (ntohs (hello->header.size) == size) && 130 (ntohs (hello->size) == size))
131 (size == GNUNET_HELLO_size (hello)))
132 { 131 {
133 struct CadetPeer *peer; 132 struct CadetPeer *peer;
134 133
@@ -152,13 +151,13 @@ static void
152announce_id (void *cls) 151announce_id (void *cls)
153{ 152{
154 struct GNUNET_HashCode phash; 153 struct GNUNET_HashCode phash;
155 const struct GNUNET_HELLO_Message *hello; 154 const struct GNUNET_MessageHeader *hello;
156 size_t size; 155 size_t size;
157 struct GNUNET_TIME_Absolute expiration; 156 struct GNUNET_TIME_Absolute expiration;
158 struct GNUNET_TIME_Relative next_put; 157 struct GNUNET_TIME_Relative next_put;
159 158
160 hello = GCH_get_mine (); 159 hello = GCH_get_mine ();
161 size = (NULL != hello) ? GNUNET_HELLO_size (hello) : 0; 160 size = (NULL != hello) ? ntohs(hello->size) : 0;
162 if (0 == size) 161 if (0 == size)
163 { 162 {
164 expiration = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), 163 expiration = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
@@ -167,7 +166,7 @@ announce_id (void *cls)
167 } 166 }
168 else 167 else
169 { 168 {
170 expiration = GNUNET_HELLO_get_last_expiration (hello); 169 expiration = GNUNET_HELLO_builder_get_expiration_time (hello);
171 announce_delay = GNUNET_TIME_UNIT_SECONDS; 170 announce_delay = GNUNET_TIME_UNIT_SECONDS;
172 } 171 }
173 172
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index c4193c2e4..1ab6ac2b8 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -554,45 +554,6 @@ GSF_test_get_load_too_high_ (uint32_t priority)
554 554
555 555
556/** 556/**
557 * We've received peer performance information. Update
558 * our running average for the P2P latency.
559 *
560 * @param cls closure
561 * @param address the address
562 * @param active is this address in active use
563 * @param bandwidth_out assigned outbound bandwidth for the connection
564 * @param bandwidth_in assigned inbound bandwidth for the connection
565 * @param prop performance data for the address (as far as known)
566 */
567static void
568update_latencies (void *cls,
569 const struct GNUNET_HELLO_Address *address,
570 int active,
571 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
572 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
573 const struct GNUNET_ATS_Properties *prop)
574{
575 if (NULL == address)
576 {
577 /* ATS service temporarily disconnected */
578 return;
579 }
580
581 if (GNUNET_YES != active)
582 return;
583 GSF_update_peer_latency_ (&address->peer,
584 prop->delay);
585 GSF_avg_latency.rel_value_us =
586 (GSF_avg_latency.rel_value_us * 31
587 + GNUNET_MIN (5000, prop->delay.rel_value_us)) / 32;
588 GNUNET_STATISTICS_set (GSF_stats,
589 gettext_noop ("# running average P2P latency (ms)"),
590 GSF_avg_latency.rel_value_us / 1000LL,
591 GNUNET_NO);
592}
593
594
595/**
596 * Check P2P "PUT" message. 557 * Check P2P "PUT" message.
597 * 558 *
598 * @param cls closure with the `struct GSF_ConnectedPeer` 559 * @param cls closure with the `struct GSF_ConnectedPeer`
diff --git a/src/fs/gnunet-service-fs.h b/src/fs/gnunet-service-fs.h
index 7bbab1022..e102a1fba 100644
--- a/src/fs/gnunet-service-fs.h
+++ b/src/fs/gnunet-service-fs.h
@@ -30,7 +30,6 @@
30#include "gnunet_statistics_service.h" 30#include "gnunet_statistics_service.h"
31#include "gnunet_core_service.h" 31#include "gnunet_core_service.h"
32#include "gnunet_block_lib.h" 32#include "gnunet_block_lib.h"
33#include "gnunet_ats_service.h"
34#include "fs.h" 33#include "fs.h"
35 34
36 35