aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-09 15:12:40 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-09 15:12:40 +0000
commitef9e50ff435266d37de3b5c54fbebbfa3a68db7c (patch)
treeeb58638cf080f82bdc02567868a8eb19758a7aa5 /src
parent72a2c1b9542d68eab32f483a1c53eeec19bc12b3 (diff)
downloadgnunet-ef9e50ff435266d37de3b5c54fbebbfa3a68db7c.tar.gz
gnunet-ef9e50ff435266d37de3b5c54fbebbfa3a68db7c.zip
perform proper locking and unlocking
Diffstat (limited to 'src')
-rw-r--r--src/ats/perf_ats_solver.c5
-rw-r--r--src/ats/plugin_ats_proportional.c18
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)
1189 &do_delete_address, 1189 &do_delete_address,
1190 NULL); 1190 NULL);
1191 } 1191 }
1192 if (GNUNET_NO == ph.bulk_running)
1193 {
1194 ph.sf->s_bulk_stop (ph.sf->cls);
1195 ph.bulk_running = GNUNET_NO;
1196 }
1192 1197
1193 GNUNET_log(GNUNET_ERROR_TYPE_INFO, 1198 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
1194 "Iteration done\n"); 1199 "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
198 */ 198 */
199 unsigned int active_addresses; 199 unsigned int active_addresses;
200 200
201 /**
202 * Number of networks in @a network_entries
203 */
204 unsigned int network_count;
205}; 201};
206 202
207 203
@@ -425,7 +421,7 @@ distribute_bandwidth_in_network (struct GAS_PROPORTIONAL_Handle *s,
425{ 421{
426 unsigned int i; 422 unsigned int i;
427 423
428 if (GNUNET_YES == s->bulk_lock) 424 if (0 != s->bulk_lock)
429 { 425 {
430 s->bulk_requests++; 426 s->bulk_requests++;
431 return; 427 return;
@@ -461,11 +457,14 @@ distribute_bandwidth_in_network (struct GAS_PROPORTIONAL_Handle *s,
461 } 457 }
462 else 458 else
463 { 459 {
460 LOG (GNUNET_ERROR_TYPE_DEBUG,
461 "Redistributing bandwidth in all %u networks\n",
462 s->env->network_count);
464 s->env->info_cb (s->env->cls, 463 s->env->info_cb (s->env->cls,
465 GAS_OP_SOLVE_START, 464 GAS_OP_SOLVE_START,
466 GAS_STAT_SUCCESS, 465 GAS_STAT_SUCCESS,
467 GAS_INFO_PROP_ALL); 466 GAS_INFO_PROP_ALL);
468 for (i = 0; i < s->network_count; i++) 467 for (i = 0; i < s->env->network_count; i++)
469 distribute_bandwidth (s, 468 distribute_bandwidth (s,
470 &s->network_entries[i]); 469 &s->network_entries[i]);
471 s->env->info_cb (s->env->cls, 470 s->env->info_cb (s->env->cls,
@@ -476,7 +475,7 @@ distribute_bandwidth_in_network (struct GAS_PROPORTIONAL_Handle *s,
476 GAS_OP_SOLVE_UPDATE_NOTIFICATION_START, 475 GAS_OP_SOLVE_UPDATE_NOTIFICATION_START,
477 GAS_STAT_SUCCESS, 476 GAS_STAT_SUCCESS,
478 GAS_INFO_PROP_ALL); 477 GAS_INFO_PROP_ALL);
479 for (i = 0; i < s->network_count; i++) 478 for (i = 0; i < s->env->network_count; i++)
480 propagate_bandwidth (s, 479 propagate_bandwidth (s,
481 &s->network_entries[i]); 480 &s->network_entries[i]);
482 s->env->info_cb (s->env->cls, 481 s->env->info_cb (s->env->cls,
@@ -816,7 +815,7 @@ update_active_address (struct GAS_PROPORTIONAL_Handle *s,
816 } 815 }
817 /* We do have a new address, activate it */ 816 /* We do have a new address, activate it */
818 LOG (GNUNET_ERROR_TYPE_DEBUG, 817 LOG (GNUNET_ERROR_TYPE_DEBUG,
819 "Suggesting new address %p for peer `%s'\n", 818 "Selecting new address %p for peer `%s'\n",
820 best_address, 819 best_address,
821 GNUNET_i2s (peer)); 820 GNUNET_i2s (peer));
822 /* Mark address as active */ 821 /* Mark address as active */
@@ -837,7 +836,6 @@ update_active_address (struct GAS_PROPORTIONAL_Handle *s,
837 best_address, 836 best_address,
838 GNUNET_i2s (peer)); 837 GNUNET_i2s (peer));
839 838
840
841 if (GNUNET_NO == 839 if (GNUNET_NO ==
842 is_bandwidth_available_in_network (asi_best->network, 840 is_bandwidth_available_in_network (asi_best->network,
843 0)) 841 0))
@@ -1245,7 +1243,7 @@ libgnunet_plugin_ats_proportional_done (void *cls)
1245 struct AddressWrapper *next; 1243 struct AddressWrapper *next;
1246 unsigned int c; 1244 unsigned int c;
1247 1245
1248 for (c = 0; c < s->network_count; c++) 1246 for (c = 0; c < s->env->network_count; c++)
1249 { 1247 {
1250 GNUNET_break (0 == s->network_entries[c].total_addresses); 1248 GNUNET_break (0 == s->network_entries[c].total_addresses);
1251 GNUNET_break (0 == s->network_entries[c].active_addresses); 1249 GNUNET_break (0 == s->network_entries[c].active_addresses);