diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-02-08 22:24:50 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-02-08 22:24:50 +0000 |
commit | c54a053bd3dcebb64604855580c6231005f70f48 (patch) | |
tree | 252d8ca7c57a67d3b9795ddab79ed3626355fca5 /src/ats/plugin_ats_proportional.c | |
parent | 6468625abca41bd7ded392bd46aba352a8643721 (diff) | |
download | gnunet-c54a053bd3dcebb64604855580c6231005f70f48.tar.gz gnunet-c54a053bd3dcebb64604855580c6231005f70f48.zip |
-when selecting addresses, kick out peers with insufficient support if we are at the limit
Diffstat (limited to 'src/ats/plugin_ats_proportional.c')
-rw-r--r-- | src/ats/plugin_ats_proportional.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/ats/plugin_ats_proportional.c b/src/ats/plugin_ats_proportional.c index 4a9dbd3ce..2521bb448 100644 --- a/src/ats/plugin_ats_proportional.c +++ b/src/ats/plugin_ats_proportional.c | |||
@@ -478,30 +478,30 @@ distribute_bandwidth (struct GAS_PROPORTIONAL_Handle *s, | |||
478 | 478 | ||
479 | remaining_quota_in = net->total_quota_in - (net->active_addresses * min_bw); | 479 | remaining_quota_in = net->total_quota_in - (net->active_addresses * min_bw); |
480 | remaining_quota_out = net->total_quota_out - (net->active_addresses * min_bw); | 480 | remaining_quota_out = net->total_quota_out - (net->active_addresses * min_bw); |
481 | LOG(GNUNET_ERROR_TYPE_DEBUG, "Remaining bandwidth : (in/out): %llu/%llu \n", | 481 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
482 | remaining_quota_in, remaining_quota_out); | 482 | "Proportionally distributable bandwidth (in/out): %llu/%llu\n", |
483 | remaining_quota_in, | ||
484 | remaining_quota_out); | ||
483 | sum_relative_peer_prefences = 0.0; | 485 | sum_relative_peer_prefences = 0.0; |
484 | 486 | ||
485 | /* Calculate sum of relative preference for active addresses in this network */ | 487 | /* Calculate sum of relative preference for active addresses in this |
488 | network */ | ||
486 | count_addresses = 0; | 489 | count_addresses = 0; |
487 | for (aw = net->head; NULL != aw; aw = aw->next) | 490 | for (aw = net->head; NULL != aw; aw = aw->next) |
488 | { | 491 | { |
489 | if (GNUNET_YES != aw->addr->active) | 492 | if (GNUNET_YES != aw->addr->active) |
490 | continue; | 493 | continue; |
491 | |||
492 | peer_relative_prefs = s->env->get_preferences (s->env->cls, | 494 | peer_relative_prefs = s->env->get_preferences (s->env->cls, |
493 | &aw->addr->peer); | 495 | &aw->addr->peer); |
494 | relative_peer_prefence = 0.0; | 496 | sum_relative_peer_prefences += peer_relative_prefs[GNUNET_ATS_PREFERENCE_BANDWIDTH]; |
495 | relative_peer_prefence += peer_relative_prefs[GNUNET_ATS_PREFERENCE_BANDWIDTH]; | 497 | count_addresses++; |
496 | sum_relative_peer_prefences += relative_peer_prefence; | ||
497 | count_addresses ++; | ||
498 | } | 498 | } |
499 | 499 | ||
500 | if (count_addresses != net->active_addresses) | 500 | if (count_addresses != net->active_addresses) |
501 | { | 501 | { |
502 | GNUNET_break (0); | 502 | GNUNET_break (0); |
503 | LOG (GNUNET_ERROR_TYPE_WARNING, | 503 | LOG (GNUNET_ERROR_TYPE_WARNING, |
504 | "%s: Counted %u active addresses, but network says to have %u active addresses\n", | 504 | "%s: Counted %u active addresses, expected %u active addresses\n", |
505 | net->desc, | 505 | net->desc, |
506 | count_addresses, | 506 | count_addresses, |
507 | net->active_addresses); | 507 | net->active_addresses); |
@@ -762,7 +762,7 @@ find_best_address_it (void *cls, | |||
762 | need = (GNUNET_YES == current->active) ? 0 : 1; | 762 | need = (GNUNET_YES == current->active) ? 0 : 1; |
763 | /* we save -1 slot if 'best' is active and belongs | 763 | /* we save -1 slot if 'best' is active and belongs |
764 | to the same network (as we would replace it) */ | 764 | to the same network (as we would replace it) */ |
765 | if ( (NULL == ctx->best) && | 765 | if ( (NULL != ctx->best) && |
766 | (GNUNET_YES == ctx->best->active) && | 766 | (GNUNET_YES == ctx->best->active) && |
767 | (((struct AddressWrapper *) ctx->best->solver_information)->network == | 767 | (((struct AddressWrapper *) ctx->best->solver_information)->network == |
768 | asi->network) ) | 768 | asi->network) ) |
@@ -1064,7 +1064,7 @@ update_active_address (struct GAS_PROPORTIONAL_Handle *s, | |||
1064 | } | 1064 | } |
1065 | } | 1065 | } |
1066 | update_active_address (s, | 1066 | update_active_address (s, |
1067 | aw_con->addr, | 1067 | aw_min->addr, |
1068 | &aw->addr->peer); | 1068 | &aw->addr->peer); |
1069 | } | 1069 | } |
1070 | distribute_bandwidth_in_network (s, | 1070 | distribute_bandwidth_in_network (s, |