diff options
Diffstat (limited to 'src/fs/gnunet-service-fs.c')
-rw-r--r-- | src/fs/gnunet-service-fs.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c index 1ff0f0496..260ffc902 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) | |||
241 | /** | 241 | /** |
242 | * We've received peer performance information. Update | 242 | * We've received peer performance information. Update |
243 | * our running average for the P2P latency. | 243 | * our running average for the P2P latency. |
244 | * | 244 | * |
245 | * @param cls closure | 245 | * @param cls closure |
246 | * @param address the address | 246 | * @param address the address |
247 | * @param active is this address in active use | 247 | * @param active is this address in active use |
248 | * @param bandwidth_out assigned outbound bandwidth for the connection | 248 | * @param bandwidth_out assigned outbound bandwidth for the connection |
249 | * @param bandwidth_in assigned inbound bandwidth for the connection | 249 | * @param bandwidth_in assigned inbound bandwidth for the connection |
250 | * @param ats performance data for the address (as far as known) | 250 | * @param prop performance data for the address (as far as known) |
251 | * @param ats_count number of performance records in @a ats | ||
252 | */ | 251 | */ |
253 | static void | 252 | static void |
254 | update_latencies (void *cls, | 253 | update_latencies (void *cls, |
@@ -256,12 +255,8 @@ update_latencies (void *cls, | |||
256 | int active, | 255 | int active, |
257 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 256 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
258 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, | 257 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, |
259 | const struct GNUNET_ATS_Information *ats, | 258 | const struct GNUNET_ATS_Properties *prop) |
260 | uint32_t ats_count) | ||
261 | { | 259 | { |
262 | unsigned int i; | ||
263 | struct GNUNET_TIME_Relative latency; | ||
264 | |||
265 | if (NULL == address) | 260 | if (NULL == address) |
266 | { | 261 | { |
267 | /* ATS service temporarily disconnected */ | 262 | /* ATS service temporarily disconnected */ |
@@ -270,22 +265,15 @@ update_latencies (void *cls, | |||
270 | 265 | ||
271 | if (GNUNET_YES != active) | 266 | if (GNUNET_YES != active) |
272 | return; | 267 | return; |
273 | for (i = 0; i < ats_count; i++) | 268 | GSF_update_peer_latency_ (&address->peer, |
274 | { | 269 | prop->delay); |
275 | if (GNUNET_ATS_QUALITY_NET_DELAY != ntohl (ats[i].type)) | 270 | GSF_avg_latency.rel_value_us = |
276 | continue; | 271 | (GSF_avg_latency.rel_value_us * 31 + |
277 | latency.rel_value_us = ntohl (ats[i].value); | 272 | GNUNET_MIN (5000, prop->delay.rel_value_us)) / 32; |
278 | GSF_update_peer_latency_ (&address->peer, | 273 | GNUNET_STATISTICS_set (GSF_stats, |
279 | latency); | 274 | gettext_noop ("# running average P2P latency (ms)"), |
280 | GSF_avg_latency.rel_value_us = | 275 | GSF_avg_latency.rel_value_us / 1000LL, |
281 | (GSF_avg_latency.rel_value_us * 31 + | 276 | GNUNET_NO); |
282 | GNUNET_MIN (5000, ntohl (ats[i].value))) / 32; | ||
283 | GNUNET_STATISTICS_set (GSF_stats, | ||
284 | gettext_noop | ||
285 | ("# running average P2P latency (ms)"), | ||
286 | GSF_avg_latency.rel_value_us / 1000LL, GNUNET_NO); | ||
287 | break; | ||
288 | } | ||
289 | } | 277 | } |
290 | 278 | ||
291 | 279 | ||