diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-06-18 06:29:10 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-06-18 06:29:10 +0000 |
commit | 34410c93193c7175aba1f46bee08587c7d926b90 (patch) | |
tree | 0d6765ca84954395797a78f948af984a32534ac3 /src/ats/gnunet-service-ats-solver_proportional.c | |
parent | a1a3e38bf8d6f8e67c5e9f1109706bece9bef10c (diff) | |
download | gnunet-34410c93193c7175aba1f46bee08587c7d926b90.tar.gz gnunet-34410c93193c7175aba1f46bee08587c7d926b90.zip |
Diffstat (limited to 'src/ats/gnunet-service-ats-solver_proportional.c')
-rw-r--r-- | src/ats/gnunet-service-ats-solver_proportional.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/ats/gnunet-service-ats-solver_proportional.c b/src/ats/gnunet-service-ats-solver_proportional.c index 0da9fdc33..1590493c4 100644 --- a/src/ats/gnunet-service-ats-solver_proportional.c +++ b/src/ats/gnunet-service-ats-solver_proportional.c | |||
@@ -434,12 +434,20 @@ distribute_bandwidth_in_network (struct GAS_PROPORTIONAL_Handle *s, | |||
434 | { | 434 | { |
435 | t = GAS_normalization_get_preferences (&cur->addr->peer); | 435 | t = GAS_normalization_get_preferences (&cur->addr->peer); |
436 | if (NULL == t) | 436 | if (NULL == t) |
437 | { | ||
437 | total_prefs += DEFAULT_REL_PREFERENCE; | 438 | total_prefs += DEFAULT_REL_PREFERENCE; |
439 | } | ||
438 | else | 440 | else |
439 | { | 441 | { |
440 | peer_prefs = 0.0; | 442 | peer_prefs = 0.0; |
441 | for (c = 1; c < GNUNET_ATS_PreferenceCount; c++) | 443 | for (c = 0; c < GNUNET_ATS_PreferenceCount; c++) |
442 | peer_prefs += t[c]; | 444 | { |
445 | if (c != GNUNET_ATS_PREFERENCE_END) | ||
446 | { | ||
447 | //fprintf (stderr, "VALUE[%u] %s %.3f \n", c, GNUNET_i2s (&cur->addr->peer), t[c]); | ||
448 | peer_prefs += t[c]; | ||
449 | } | ||
450 | } | ||
443 | total_prefs += (peer_prefs / (GNUNET_ATS_PreferenceCount -1)); | 451 | total_prefs += (peer_prefs / (GNUNET_ATS_PreferenceCount -1)); |
444 | } | 452 | } |
445 | } | 453 | } |
@@ -452,12 +460,17 @@ distribute_bandwidth_in_network (struct GAS_PROPORTIONAL_Handle *s, | |||
452 | t = GAS_normalization_get_preferences (&cur->addr->peer); | 460 | t = GAS_normalization_get_preferences (&cur->addr->peer); |
453 | if (NULL != t) | 461 | if (NULL != t) |
454 | { | 462 | { |
455 | for (c = 1; c < GNUNET_ATS_PreferenceCount; c++) | 463 | for (c = 0; c < GNUNET_ATS_PreferenceCount; c++) |
456 | cur_pref += t[c]; | 464 | { |
465 | if (c != GNUNET_ATS_PREFERENCE_END) | ||
466 | cur_pref += t[c]; | ||
467 | } | ||
457 | cur_pref /= 2; | 468 | cur_pref /= 2; |
458 | } | 469 | } |
459 | else | 470 | else |
471 | { | ||
460 | cur_pref = DEFAULT_REL_PREFERENCE; | 472 | cur_pref = DEFAULT_REL_PREFERENCE; |
473 | } | ||
461 | 474 | ||
462 | assigned_quota_in = min_bw + ((cur_pref / total_prefs) * remaining_quota_in); | 475 | assigned_quota_in = min_bw + ((cur_pref / total_prefs) * remaining_quota_in); |
463 | assigned_quota_out = min_bw + ((cur_pref / total_prefs) * remaining_quota_out); | 476 | assigned_quota_out = min_bw + ((cur_pref / total_prefs) * remaining_quota_out); |