diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-02-08 13:04:27 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-02-08 13:04:27 +0000 |
commit | b644458a5800a53f3b0196fe559d51a21dca70b9 (patch) | |
tree | fa7f8b8a497d5306b68f9f2fe41e565365f8c5c9 /src/ats/plugin_ats_proportional.c | |
parent | 6115a1150c65bd4a33ed61c6e96594c4a73d86ac (diff) | |
download | gnunet-b644458a5800a53f3b0196fe559d51a21dca70b9.tar.gz gnunet-b644458a5800a53f3b0196fe559d51a21dca70b9.zip |
simplify normalization logic, also have clients access norm array of address directly
Diffstat (limited to 'src/ats/plugin_ats_proportional.c')
-rw-r--r-- | src/ats/plugin_ats_proportional.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/ats/plugin_ats_proportional.c b/src/ats/plugin_ats_proportional.c index e45244ec0..ad85f805e 100644 --- a/src/ats/plugin_ats_proportional.c +++ b/src/ats/plugin_ats_proportional.c | |||
@@ -687,8 +687,6 @@ find_best_address_it (void *cls, | |||
687 | struct AddressSolverInformation *asi; | 687 | struct AddressSolverInformation *asi; |
688 | struct GNUNET_TIME_Relative active_time; | 688 | struct GNUNET_TIME_Relative active_time; |
689 | struct GNUNET_TIME_Relative min_active_time; | 689 | struct GNUNET_TIME_Relative min_active_time; |
690 | const double *norm_prop_cur; | ||
691 | const double *norm_prop_best; | ||
692 | double best_delay; | 690 | double best_delay; |
693 | double best_distance; | 691 | double best_distance; |
694 | double cur_delay; | 692 | double cur_delay; |
@@ -738,19 +736,12 @@ find_best_address_it (void *cls, | |||
738 | } | 736 | } |
739 | 737 | ||
740 | /* Now compare ATS information */ | 738 | /* Now compare ATS information */ |
741 | norm_prop_cur = ctx->s->env->get_property (ctx->s->env->cls, | ||
742 | current); | ||
743 | index = find_property_index (GNUNET_ATS_QUALITY_NET_DISTANCE); | 739 | index = find_property_index (GNUNET_ATS_QUALITY_NET_DISTANCE); |
744 | cur_distance = norm_prop_cur[index]; | 740 | cur_distance = current->atsin[index].norm; |
741 | best_distance = ctx->best->atsin[index].norm; | ||
745 | index = find_property_index (GNUNET_ATS_QUALITY_NET_DELAY); | 742 | index = find_property_index (GNUNET_ATS_QUALITY_NET_DELAY); |
746 | cur_delay = norm_prop_cur[index]; | 743 | cur_delay = current->atsin[index].norm; |
747 | 744 | best_delay = ctx->best->atsin[index].norm; | |
748 | norm_prop_best = ctx->s->env->get_property (ctx->s->env->cls, | ||
749 | ctx->best); | ||
750 | index = find_property_index (GNUNET_ATS_QUALITY_NET_DISTANCE); | ||
751 | best_distance = norm_prop_best[index]; | ||
752 | index = find_property_index (GNUNET_ATS_QUALITY_NET_DELAY); | ||
753 | best_delay = norm_prop_best[index]; | ||
754 | 745 | ||
755 | /* user shorter distance */ | 746 | /* user shorter distance */ |
756 | if (cur_distance < best_distance) | 747 | if (cur_distance < best_distance) |
@@ -1614,7 +1605,7 @@ GAS_proportional_address_add (void *solver, | |||
1614 | static void | 1605 | static void |
1615 | GAS_proportional_address_property_changed (void *solver, | 1606 | GAS_proportional_address_property_changed (void *solver, |
1616 | struct ATS_Address *address, | 1607 | struct ATS_Address *address, |
1617 | uint32_t type, | 1608 | enum GNUNET_ATS_Property type, |
1618 | uint32_t abs_value, | 1609 | uint32_t abs_value, |
1619 | double rel_value) | 1610 | double rel_value) |
1620 | { | 1611 | { |
@@ -1738,7 +1729,6 @@ libgnunet_plugin_ats_proportional_init (void *cls) | |||
1738 | GNUNET_assert (NULL != env->cfg); | 1729 | GNUNET_assert (NULL != env->cfg); |
1739 | GNUNET_assert (NULL != env->bandwidth_changed_cb); | 1730 | GNUNET_assert (NULL != env->bandwidth_changed_cb); |
1740 | GNUNET_assert (NULL != env->get_preferences); | 1731 | GNUNET_assert (NULL != env->get_preferences); |
1741 | GNUNET_assert (NULL != env->get_property); | ||
1742 | 1732 | ||
1743 | s = GNUNET_new (struct GAS_PROPORTIONAL_Handle); | 1733 | s = GNUNET_new (struct GAS_PROPORTIONAL_Handle); |
1744 | s->env = env; | 1734 | s->env = env; |