aboutsummaryrefslogtreecommitdiff
path: root/src/fs/gnunet-service-fs.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-10 23:24:01 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-10 23:24:01 +0000
commit1c323bd4cbb388a9e7515a1f733a3062bf093aee (patch)
tree7cc525d79149d44840b9f7a0040aaf3e69ecd665 /src/fs/gnunet-service-fs.c
parentaedaaed687db1ff20b447378f01ad7306921450c (diff)
fixing #3657 (replace ATS_Information with struct), but WIHTOUT fixing ATS testcases yet
Diffstat (limited to 'src/fs/gnunet-service-fs.c')
-rw-r--r--src/fs/gnunet-service-fs.c36
1 files changed, 12 insertions, 24 deletions
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index 1ff0f04968..260ffc902f 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -241,14 +241,13 @@ GSF_test_get_load_too_high_ (uint32_t priority)
/**
* We've received peer performance information. Update
* our running average for the P2P latency.
-*
+ *
* @param cls closure
* @param address the address
* @param active is this address in active use
* @param bandwidth_out assigned outbound bandwidth for the connection
* @param bandwidth_in assigned inbound bandwidth for the connection
- * @param ats performance data for the address (as far as known)
- * @param ats_count number of performance records in @a ats
+ * @param prop performance data for the address (as far as known)
*/
static void
update_latencies (void *cls,
@@ -256,12 +255,8 @@ update_latencies (void *cls,
int active,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
- const struct GNUNET_ATS_Information *ats,
- uint32_t ats_count)
+ const struct GNUNET_ATS_Properties *prop)
{
- unsigned int i;
- struct GNUNET_TIME_Relative latency;
-
if (NULL == address)
{
/* ATS service temporarily disconnected */
@@ -270,22 +265,15 @@ update_latencies (void *cls,
if (GNUNET_YES != active)
return;
- for (i = 0; i < ats_count; i++)
- {
- if (GNUNET_ATS_QUALITY_NET_DELAY != ntohl (ats[i].type))
- continue;
- latency.rel_value_us = ntohl (ats[i].value);
- GSF_update_peer_latency_ (&address->peer,
- latency);
- GSF_avg_latency.rel_value_us =
- (GSF_avg_latency.rel_value_us * 31 +
- GNUNET_MIN (5000, ntohl (ats[i].value))) / 32;
- GNUNET_STATISTICS_set (GSF_stats,
- gettext_noop
- ("# running average P2P latency (ms)"),
- GSF_avg_latency.rel_value_us / 1000LL, GNUNET_NO);
- break;
- }
+ GSF_update_peer_latency_ (&address->peer,
+ prop->delay);
+ GSF_avg_latency.rel_value_us =
+ (GSF_avg_latency.rel_value_us * 31 +
+ GNUNET_MIN (5000, prop->delay.rel_value_us)) / 32;
+ GNUNET_STATISTICS_set (GSF_stats,
+ gettext_noop ("# running average P2P latency (ms)"),
+ GSF_avg_latency.rel_value_us / 1000LL,
+ GNUNET_NO);
}