diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-11-07 10:16:57 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-11-07 10:16:57 +0000 |
commit | a5d49c625fba61ca1f8cc8b6d0db1c9367558622 (patch) | |
tree | 45c0fff0ad7904852acf4a7781414f39d0352eba /src/ats | |
parent | 734d95900828a11e8716ebb3b0876558d2dc47e2 (diff) | |
download | gnunet-a5d49c625fba61ca1f8cc8b6d0db1c9367558622.tar.gz gnunet-a5d49c625fba61ca1f8cc8b6d0db1c9367558622.zip |
randomization was off by one
Diffstat (limited to 'src/ats')
-rw-r--r-- | src/ats/libgnunet_plugin_ats_mlp.c | 12 | ||||
-rw-r--r-- | src/ats/libgnunet_plugin_ats_proportional.c | 1 | ||||
-rw-r--r-- | src/ats/perf_ats_solver.c | 2 |
3 files changed, 13 insertions, 2 deletions
diff --git a/src/ats/libgnunet_plugin_ats_mlp.c b/src/ats/libgnunet_plugin_ats_mlp.c index aef0c1875..ed2cf5987 100644 --- a/src/ats/libgnunet_plugin_ats_mlp.c +++ b/src/ats/libgnunet_plugin_ats_mlp.c | |||
@@ -1266,6 +1266,12 @@ GAS_mlp_address_add (void *solver, | |||
1266 | GNUNET_assert (NULL != solver); | 1266 | GNUNET_assert (NULL != solver); |
1267 | GNUNET_assert (NULL != address); | 1267 | GNUNET_assert (NULL != address); |
1268 | 1268 | ||
1269 | if (GNUNET_ATS_NetworkTypeCount >= network) | ||
1270 | { | ||
1271 | GNUNET_break (0); | ||
1272 | return; | ||
1273 | } | ||
1274 | |||
1269 | if (NULL == address->solver_information) | 1275 | if (NULL == address->solver_information) |
1270 | { | 1276 | { |
1271 | address->solver_information = GNUNET_new (struct MLP_information); | 1277 | address->solver_information = GNUNET_new (struct MLP_information); |
@@ -1429,6 +1435,12 @@ GAS_mlp_address_change_network (void *solver, | |||
1429 | GNUNET_assert (NULL != solver); | 1435 | GNUNET_assert (NULL != solver); |
1430 | GNUNET_assert (NULL != address); | 1436 | GNUNET_assert (NULL != address); |
1431 | 1437 | ||
1438 | if (GNUNET_ATS_NetworkTypeCount >= new_network) | ||
1439 | { | ||
1440 | GNUNET_break (0); | ||
1441 | return; | ||
1442 | } | ||
1443 | |||
1432 | if (NULL == mlpi) | 1444 | if (NULL == mlpi) |
1433 | { | 1445 | { |
1434 | GNUNET_break (0); | 1446 | GNUNET_break (0); |
diff --git a/src/ats/libgnunet_plugin_ats_proportional.c b/src/ats/libgnunet_plugin_ats_proportional.c index c444adba4..0cbf2d26a 100644 --- a/src/ats/libgnunet_plugin_ats_proportional.c +++ b/src/ats/libgnunet_plugin_ats_proportional.c | |||
@@ -1490,7 +1490,6 @@ GAS_proportional_address_add (void *solver, struct ATS_Address *address, | |||
1490 | struct AddressWrapper *aw = NULL; | 1490 | struct AddressWrapper *aw = NULL; |
1491 | 1491 | ||
1492 | GNUNET_assert(NULL != s); | 1492 | GNUNET_assert(NULL != s); |
1493 | |||
1494 | net = get_network (s, network); | 1493 | net = get_network (s, network); |
1495 | if (NULL == net) | 1494 | if (NULL == net) |
1496 | { | 1495 | { |
diff --git a/src/ats/perf_ats_solver.c b/src/ats/perf_ats_solver.c index 20a6cb9ed..91068b4ce 100644 --- a/src/ats/perf_ats_solver.c +++ b/src/ats/perf_ats_solver.c | |||
@@ -844,7 +844,7 @@ perf_run () | |||
844 | { | 844 | { |
845 | cur_addr = perf_create_address (cp, ca); | 845 | cur_addr = perf_create_address (cp, ca); |
846 | /* Add address */ | 846 | /* Add address */ |
847 | ph.env.sf.s_add (ph.solver, cur_addr, GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_ATS_NetworkTypeCount + 1)); | 847 | ph.env.sf.s_add (ph.solver, cur_addr, GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_ATS_NetworkTypeCount)); |
848 | ph.current_a = ca + 1; | 848 | ph.current_a = ca + 1; |
849 | perf_address_initial_update (ph.solver, ph.addresses, cur_addr); | 849 | perf_address_initial_update (ph.solver, ph.addresses, cur_addr); |
850 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 850 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |