aboutsummaryrefslogtreecommitdiff
path: root/src/fs
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
parentaedaaed687db1ff20b447378f01ad7306921450c (diff)
downloadgnunet-1c323bd4cbb388a9e7515a1f733a3062bf093aee.tar.gz
gnunet-1c323bd4cbb388a9e7515a1f733a3062bf093aee.zip
fixing #3657 (replace ATS_Information with struct), but WIHTOUT fixing ATS testcases yet
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/gnunet-service-fs.c36
-rw-r--r--src/fs/gnunet-service-fs_cp.c9
-rw-r--r--src/fs/gnunet-service-fs_cp.h5
3 files changed, 17 insertions, 33 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 */
253static void 252static void
254update_latencies (void *cls, 253update_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
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c
index f7d64a49e..749ef15c7 100644
--- a/src/fs/gnunet-service-fs_cp.c
+++ b/src/fs/gnunet-service-fs_cp.c
@@ -348,7 +348,6 @@ GSF_update_peer_latency_ (const struct GNUNET_PeerIdentity *id,
348 if (NULL == cp) 348 if (NULL == cp)
349 return; /* we're not yet connected at the core level, ignore */ 349 return; /* we're not yet connected at the core level, ignore */
350 GNUNET_LOAD_value_set_decline (cp->ppd.transmission_delay, latency); 350 GNUNET_LOAD_value_set_decline (cp->ppd.transmission_delay, latency);
351 /* LATER: merge atsi into cp's performance data (if we ever care...) */
352} 351}
353 352
354 353
@@ -416,9 +415,11 @@ schedule_transmission (struct GSF_PeerTransmitHandle *pth)
416 415
417 if (0 != cp->inc_preference) 416 if (0 != cp->inc_preference)
418 { 417 {
419 GNUNET_ATS_performance_change_preference (GSF_ats, &target, GNUNET_ATS_PREFERENCE_BANDWIDTH, 418 GNUNET_ATS_performance_change_preference (GSF_ats,
420 (double) cp->inc_preference, 419 &target,
421 GNUNET_ATS_PREFERENCE_END); 420 GNUNET_ATS_PREFERENCE_BANDWIDTH,
421 (double) cp->inc_preference,
422 GNUNET_ATS_PREFERENCE_END);
422 cp->inc_preference = 0; 423 cp->inc_preference = 0;
423 } 424 }
424 425
diff --git a/src/fs/gnunet-service-fs_cp.h b/src/fs/gnunet-service-fs_cp.h
index 502b8652f..eca6ff1ed 100644
--- a/src/fs/gnunet-service-fs_cp.h
+++ b/src/fs/gnunet-service-fs_cp.h
@@ -67,11 +67,6 @@ struct GSF_PeerPerformanceData
67{ 67{
68 68
69 /** 69 /**
70 * Transport performance data.
71 */
72 struct GNUNET_ATS_Information *atsi;
73
74 /**
75 * List of the last clients for which this peer successfully 70 * List of the last clients for which this peer successfully
76 * answered a query. 71 * answered a query.
77 */ 72 */