From ef9e50ff435266d37de3b5c54fbebbfa3a68db7c Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 9 Feb 2015 15:12:40 +0000 Subject: perform proper locking and unlocking --- src/ats/perf_ats_solver.c | 5 +++++ src/ats/plugin_ats_proportional.c | 18 ++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/ats/perf_ats_solver.c b/src/ats/perf_ats_solver.c index 3f9c12f20..9f02b5307 100644 --- a/src/ats/perf_ats_solver.c +++ b/src/ats/perf_ats_solver.c @@ -1189,6 +1189,11 @@ perf_run_iteration (void) &do_delete_address, NULL); } + if (GNUNET_NO == ph.bulk_running) + { + ph.sf->s_bulk_stop (ph.sf->cls); + ph.bulk_running = GNUNET_NO; + } GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Iteration done\n"); diff --git a/src/ats/plugin_ats_proportional.c b/src/ats/plugin_ats_proportional.c index 6fd7e42a1..69afa8a52 100644 --- a/src/ats/plugin_ats_proportional.c +++ b/src/ats/plugin_ats_proportional.c @@ -198,10 +198,6 @@ struct GAS_PROPORTIONAL_Handle */ unsigned int active_addresses; - /** - * Number of networks in @a network_entries - */ - unsigned int network_count; }; @@ -425,7 +421,7 @@ distribute_bandwidth_in_network (struct GAS_PROPORTIONAL_Handle *s, { unsigned int i; - if (GNUNET_YES == s->bulk_lock) + if (0 != s->bulk_lock) { s->bulk_requests++; return; @@ -461,11 +457,14 @@ distribute_bandwidth_in_network (struct GAS_PROPORTIONAL_Handle *s, } else { + LOG (GNUNET_ERROR_TYPE_DEBUG, + "Redistributing bandwidth in all %u networks\n", + s->env->network_count); s->env->info_cb (s->env->cls, GAS_OP_SOLVE_START, GAS_STAT_SUCCESS, GAS_INFO_PROP_ALL); - for (i = 0; i < s->network_count; i++) + for (i = 0; i < s->env->network_count; i++) distribute_bandwidth (s, &s->network_entries[i]); s->env->info_cb (s->env->cls, @@ -476,7 +475,7 @@ distribute_bandwidth_in_network (struct GAS_PROPORTIONAL_Handle *s, GAS_OP_SOLVE_UPDATE_NOTIFICATION_START, GAS_STAT_SUCCESS, GAS_INFO_PROP_ALL); - for (i = 0; i < s->network_count; i++) + for (i = 0; i < s->env->network_count; i++) propagate_bandwidth (s, &s->network_entries[i]); s->env->info_cb (s->env->cls, @@ -816,7 +815,7 @@ update_active_address (struct GAS_PROPORTIONAL_Handle *s, } /* We do have a new address, activate it */ LOG (GNUNET_ERROR_TYPE_DEBUG, - "Suggesting new address %p for peer `%s'\n", + "Selecting new address %p for peer `%s'\n", best_address, GNUNET_i2s (peer)); /* Mark address as active */ @@ -837,7 +836,6 @@ update_active_address (struct GAS_PROPORTIONAL_Handle *s, best_address, GNUNET_i2s (peer)); - if (GNUNET_NO == is_bandwidth_available_in_network (asi_best->network, 0)) @@ -1245,7 +1243,7 @@ libgnunet_plugin_ats_proportional_done (void *cls) struct AddressWrapper *next; unsigned int c; - for (c = 0; c < s->network_count; c++) + for (c = 0; c < s->env->network_count; c++) { GNUNET_break (0 == s->network_entries[c].total_addresses); GNUNET_break (0 == s->network_entries[c].active_addresses); -- cgit v1.2.3