diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-06-19 04:59:00 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-06-19 04:59:00 +0000 |
commit | bf944ec6ae4fb8a2968afb4be07763ec0af75e07 (patch) | |
tree | af9fed764acfad1809ff0361002e90f29c8fba49 /src/ats/gnunet-service-ats-solver_proportional.c | |
parent | 4c385751ebc2918e91726ed3871bbf38d06271de (diff) | |
download | gnunet-bf944ec6ae4fb8a2968afb4be07763ec0af75e07.tar.gz gnunet-bf944ec6ae4fb8a2968afb4be07763ec0af75e07.zip |
remove normalization from solvers, use in address only
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 1bcd42e04..30a3b060d 100644 --- a/src/ats/gnunet-service-ats-solver_proportional.c +++ b/src/ats/gnunet-service-ats-solver_proportional.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet_util_lib.h" | 28 | #include "gnunet_util_lib.h" |
29 | #include "gnunet-service-ats_addresses.h" | 29 | #include "gnunet-service-ats_addresses.h" |
30 | #include "gnunet-service-ats_normalization.h" | ||
31 | #include "gnunet_statistics_service.h" | 30 | #include "gnunet_statistics_service.h" |
32 | 31 | ||
33 | #define LOG(kind,...) GNUNET_log_from (kind, "ats-proportional",__VA_ARGS__) | 32 | #define LOG(kind,...) GNUNET_log_from (kind, "ats-proportional",__VA_ARGS__) |
@@ -255,6 +254,16 @@ struct GAS_PROPORTIONAL_Handle | |||
255 | */ | 254 | */ |
256 | void *bw_changed_cls; | 255 | void *bw_changed_cls; |
257 | 256 | ||
257 | /** | ||
258 | * ATS function to get preferences | ||
259 | */ | ||
260 | GAS_get_preferences get_preferences; | ||
261 | |||
262 | /** | ||
263 | * Closure for ATS function to get preferences | ||
264 | */ | ||
265 | void *get_preferences_cls; | ||
266 | |||
258 | struct GNUNET_CONTAINER_MultiHashMap *prefs; | 267 | struct GNUNET_CONTAINER_MultiHashMap *prefs; |
259 | 268 | ||
260 | struct PreferenceClient *pc_head; | 269 | struct PreferenceClient *pc_head; |
@@ -432,7 +441,7 @@ distribute_bandwidth_in_network (struct GAS_PROPORTIONAL_Handle *s, | |||
432 | { | 441 | { |
433 | if (GNUNET_YES == cur->addr->active) | 442 | if (GNUNET_YES == cur->addr->active) |
434 | { | 443 | { |
435 | GNUNET_assert (NULL != (t = GAS_normalization_get_preferences (&cur->addr->peer))); | 444 | GNUNET_assert (NULL != (t = s->get_preferences (s->get_preferences_cls, &cur->addr->peer))); |
436 | 445 | ||
437 | peer_prefs = 0.0; | 446 | peer_prefs = 0.0; |
438 | for (c = 0; c < GNUNET_ATS_PreferenceCount; c++) | 447 | for (c = 0; c < GNUNET_ATS_PreferenceCount; c++) |
@@ -451,7 +460,7 @@ distribute_bandwidth_in_network (struct GAS_PROPORTIONAL_Handle *s, | |||
451 | if (GNUNET_YES == cur->addr->active) | 460 | if (GNUNET_YES == cur->addr->active) |
452 | { | 461 | { |
453 | cur_pref = 0.0; | 462 | cur_pref = 0.0; |
454 | GNUNET_assert (NULL != (t = GAS_normalization_get_preferences (&cur->addr->peer))); | 463 | GNUNET_assert (NULL != (t = s->get_preferences (s->get_preferences_cls, &cur->addr->peer))); |
455 | 464 | ||
456 | for (c = 0; c < GNUNET_ATS_PreferenceCount; c++) | 465 | for (c = 0; c < GNUNET_ATS_PreferenceCount; c++) |
457 | { | 466 | { |
@@ -1226,7 +1235,9 @@ GAS_proportional_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1226 | unsigned long long *in_quota, | 1235 | unsigned long long *in_quota, |
1227 | int dest_length, | 1236 | int dest_length, |
1228 | GAS_bandwidth_changed_cb bw_changed_cb, | 1237 | GAS_bandwidth_changed_cb bw_changed_cb, |
1229 | void *bw_changed_cb_cls) | 1238 | void *bw_changed_cb_cls, |
1239 | GAS_get_preferences get_preference, | ||
1240 | void *get_preference_cls) | ||
1230 | { | 1241 | { |
1231 | int c; | 1242 | int c; |
1232 | struct GAS_PROPORTIONAL_Handle *s = GNUNET_malloc (sizeof (struct GAS_PROPORTIONAL_Handle)); | 1243 | struct GAS_PROPORTIONAL_Handle *s = GNUNET_malloc (sizeof (struct GAS_PROPORTIONAL_Handle)); |
@@ -1237,6 +1248,8 @@ GAS_proportional_init (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1237 | s->stats = (struct GNUNET_STATISTICS_Handle *) stats; | 1248 | s->stats = (struct GNUNET_STATISTICS_Handle *) stats; |
1238 | s->bw_changed = bw_changed_cb; | 1249 | s->bw_changed = bw_changed_cb; |
1239 | s->bw_changed_cls = bw_changed_cb_cls; | 1250 | s->bw_changed_cls = bw_changed_cb_cls; |
1251 | s->get_preferences = get_preference; | ||
1252 | s->get_preferences_cls = get_preference_cls; | ||
1240 | s->networks = dest_length; | 1253 | s->networks = dest_length; |
1241 | s->network_entries = GNUNET_malloc (dest_length * sizeof (struct Network)); | 1254 | s->network_entries = GNUNET_malloc (dest_length * sizeof (struct Network)); |
1242 | s->active_addresses = 0; | 1255 | s->active_addresses = 0; |