+/**
+ * We've received peer performance information. Update
+ * our running average for the P2P latency.
+ *
+ * @param atsi performance information
+ * @param atsi_count number of 'atsi' records
+ */
+static void
+update_latencies (const struct GNUNET_ATS_Information *atsi,
+ unsigned int atsi_count)
+{
+ unsigned int i;
+
+ for (i = 0; i < atsi_count; i++)
+ {
+ if (ntohl (atsi[i].type) == GNUNET_ATS_QUALITY_NET_DELAY)
+ {
+ GSF_avg_latency.rel_value =
+ (GSF_avg_latency.rel_value * 31 + ntohl (atsi[i].value)) / 32;
+ GNUNET_STATISTICS_set (GSF_stats,
+ gettext_noop
+ ("# running average P2P latency (ms)"),
+ GSF_avg_latency.rel_value, GNUNET_NO);
+ break;
+ }
+ }
+}
+
+