diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-02-06 09:28:57 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-02-06 09:28:57 +0000 |
commit | 66d788dbe9224b7d3e51ad60d2a29a167b2e348d (patch) | |
tree | dd1737e137f070c01ef42800c4fe625f526d0214 /src | |
parent | 170d5baeece2def099112c6a25287a95d2b28899 (diff) | |
download | gnunet-66d788dbe9224b7d3e51ad60d2a29a167b2e348d.tar.gz gnunet-66d788dbe9224b7d3e51ad60d2a29a167b2e348d.zip |
get rid of stupid network[i]=i array
Diffstat (limited to 'src')
-rw-r--r-- | src/ats/ats_api_scanner.c | 2 | ||||
-rw-r--r-- | src/ats/gnunet-ats-solver-eval.c | 5 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats.c | 2 | ||||
-rw-r--r-- | src/ats/gnunet-service-ats_plugins.c | 8 | ||||
-rw-r--r-- | src/ats/perf_ats_solver.c | 8 | ||||
-rw-r--r-- | src/ats/plugin_ats_mlp.c | 117 | ||||
-rw-r--r-- | src/ats/plugin_ats_proportional.c | 42 | ||||
-rw-r--r-- | src/ats/plugin_ats_ril.c | 2 | ||||
-rw-r--r-- | src/include/gnunet_ats_plugin.h | 10 | ||||
-rw-r--r-- | src/include/gnunet_ats_service.h | 13 |
10 files changed, 83 insertions, 126 deletions
diff --git a/src/ats/ats_api_scanner.c b/src/ats/ats_api_scanner.c index 43e79b3cf..c213983f2 100644 --- a/src/ats/ats_api_scanner.c +++ b/src/ats/ats_api_scanner.c | |||
@@ -331,7 +331,7 @@ GNUNET_ATS_scanner_address_get_type (struct GNUNET_ATS_InterfaceScanner *is, | |||
331 | socklen_t addrlen) | 331 | socklen_t addrlen) |
332 | { | 332 | { |
333 | struct ATS_Network *cur = is->net_head; | 333 | struct ATS_Network *cur = is->net_head; |
334 | enum GNUNET_ATS_NetworkType type = GNUNET_ATS_NET_UNSPECIFIED; | 334 | enum GNUNET_ATS_Network_Type type = GNUNET_ATS_NET_UNSPECIFIED; |
335 | 335 | ||
336 | switch (addr->sa_family) | 336 | switch (addr->sa_family) |
337 | { | 337 | { |
diff --git a/src/ats/gnunet-ats-solver-eval.c b/src/ats/gnunet-ats-solver-eval.c index bfb1c84ab..c39bb30f7 100644 --- a/src/ats/gnunet-ats-solver-eval.c +++ b/src/ats/gnunet-ats-solver-eval.c | |||
@@ -3057,7 +3057,6 @@ GNUNET_ATS_solvers_solver_start (enum GNUNET_ATS_Solvers type) | |||
3057 | { | 3057 | { |
3058 | struct SolverHandle *sh; | 3058 | struct SolverHandle *sh; |
3059 | char * solver_str; | 3059 | char * solver_str; |
3060 | int c; | ||
3061 | 3060 | ||
3062 | switch (type) { | 3061 | switch (type) { |
3063 | case GNUNET_ATS_SOLVER_PROPORTIONAL: | 3062 | case GNUNET_ATS_SOLVER_PROPORTIONAL: |
@@ -3091,10 +3090,6 @@ GNUNET_ATS_solvers_solver_start (enum GNUNET_ATS_Solvers type) | |||
3091 | sh->env.network_count = GNUNET_ATS_NetworkTypeCount; | 3090 | sh->env.network_count = GNUNET_ATS_NetworkTypeCount; |
3092 | sh->env.info_cb = &solver_info_cb; | 3091 | sh->env.info_cb = &solver_info_cb; |
3093 | sh->env.network_count = GNUNET_ATS_NetworkTypeCount; | 3092 | sh->env.network_count = GNUNET_ATS_NetworkTypeCount; |
3094 | int networks[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkType; | ||
3095 | for (c = 0; c < GNUNET_ATS_NetworkTypeCount; c++) | ||
3096 | sh->env.networks[c] = networks[c]; | ||
3097 | |||
3098 | 3093 | ||
3099 | /* start normalization */ | 3094 | /* start normalization */ |
3100 | GAS_normalization_start (); | 3095 | GAS_normalization_start (); |
diff --git a/src/ats/gnunet-service-ats.c b/src/ats/gnunet-service-ats.c index 9c809f913..830deb04b 100644 --- a/src/ats/gnunet-service-ats.c +++ b/src/ats/gnunet-service-ats.c | |||
@@ -126,10 +126,10 @@ cleanup_task (void *cls, | |||
126 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 126 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
127 | { | 127 | { |
128 | GAS_addresses_done (); | 128 | GAS_addresses_done (); |
129 | GAS_connectivity_done (); | ||
129 | GAS_plugins_done (); | 130 | GAS_plugins_done (); |
130 | GAS_normalization_stop (); | 131 | GAS_normalization_stop (); |
131 | GAS_scheduling_done (); | 132 | GAS_scheduling_done (); |
132 | GAS_connectivity_done (); | ||
133 | GAS_performance_done (); | 133 | GAS_performance_done (); |
134 | GAS_preference_done (); | 134 | GAS_preference_done (); |
135 | GAS_reservations_done (); | 135 | GAS_reservations_done (); |
diff --git a/src/ats/gnunet-service-ats_plugins.c b/src/ats/gnunet-service-ats_plugins.c index 7e03a1a7e..6c15bc27c 100644 --- a/src/ats/gnunet-service-ats_plugins.c +++ b/src/ats/gnunet-service-ats_plugins.c | |||
@@ -452,7 +452,10 @@ GAS_plugins_init (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
452 | GNUNET_free(mode_str); | 452 | GNUNET_free(mode_str); |
453 | } | 453 | } |
454 | 454 | ||
455 | load_quotas (cfg, quotas_out, quotas_in, GNUNET_ATS_NetworkTypeCount); | 455 | load_quotas (cfg, |
456 | quotas_out, | ||
457 | quotas_in, | ||
458 | GNUNET_ATS_NetworkTypeCount); | ||
456 | env.cls = NULL; | 459 | env.cls = NULL; |
457 | env.info_cb = &solver_info_cb; | 460 | env.info_cb = &solver_info_cb; |
458 | env.bandwidth_changed_cb = &bandwidth_changed_cb; | 461 | env.bandwidth_changed_cb = &bandwidth_changed_cb; |
@@ -461,12 +464,9 @@ GAS_plugins_init (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
461 | env.cfg = cfg; | 464 | env.cfg = cfg; |
462 | env.stats = GSA_stats; | 465 | env.stats = GSA_stats; |
463 | env.addresses = GSA_addresses; | 466 | env.addresses = GSA_addresses; |
464 | |||
465 | env.network_count = GNUNET_ATS_NetworkTypeCount; | 467 | env.network_count = GNUNET_ATS_NetworkTypeCount; |
466 | int networks[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkType; | ||
467 | for (c = 0; c < GNUNET_ATS_NetworkTypeCount; c++) | 468 | for (c = 0; c < GNUNET_ATS_NetworkTypeCount; c++) |
468 | { | 469 | { |
469 | env.networks[c] = networks[c]; | ||
470 | env.out_quota[c] = quotas_out[c]; | 470 | env.out_quota[c] = quotas_out[c]; |
471 | env.in_quota[c] = quotas_in[c]; | 471 | env.in_quota[c] = quotas_in[c]; |
472 | } | 472 | } |
diff --git a/src/ats/perf_ats_solver.c b/src/ats/perf_ats_solver.c index d81b5779b..0d75561bc 100644 --- a/src/ats/perf_ats_solver.c +++ b/src/ats/perf_ats_solver.c | |||
@@ -1307,16 +1307,14 @@ run (void *cls, char * const *args, const char *cfgfile, | |||
1307 | ph.env.network_count = GNUNET_ATS_NetworkTypeCount; | 1307 | ph.env.network_count = GNUNET_ATS_NetworkTypeCount; |
1308 | ph.env.info_cb = &solver_info_cb; | 1308 | ph.env.info_cb = &solver_info_cb; |
1309 | 1309 | ||
1310 | int networks[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkType; | ||
1311 | for (c = 0; c < GNUNET_ATS_NetworkTypeCount; c++) | 1310 | for (c = 0; c < GNUNET_ATS_NetworkTypeCount; c++) |
1312 | { | 1311 | { |
1313 | ph.env.networks[c] = networks[c]; | ||
1314 | ph.env.out_quota[c] = quotas_out[c]; | 1312 | ph.env.out_quota[c] = quotas_out[c]; |
1315 | ph.env.in_quota[c] = quotas_in[c]; | 1313 | ph.env.in_quota[c] = quotas_in[c]; |
1316 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Loading network quotas: `%s' %llu %llu \n", | 1314 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Loading network quotas: `%s' %llu %llu \n", |
1317 | GNUNET_ATS_print_network_type(ph.env.networks[c]), | 1315 | GNUNET_ATS_print_network_type (c), |
1318 | ph.env.out_quota[c], | 1316 | ph.env.out_quota[c], |
1319 | ph.env.in_quota[c]); | 1317 | ph.env.in_quota[c]); |
1320 | } | 1318 | } |
1321 | GAS_normalization_start (); | 1319 | GAS_normalization_start (); |
1322 | 1320 | ||
diff --git a/src/ats/plugin_ats_mlp.c b/src/ats/plugin_ats_mlp.c index 11f74a37f..23fbf5063 100644 --- a/src/ats/plugin_ats_mlp.c +++ b/src/ats/plugin_ats_mlp.c | |||
@@ -2420,14 +2420,11 @@ libgnunet_plugin_ats_mlp_init (void *cls) | |||
2420 | static struct GNUNET_ATS_SolverFunctions sf; | 2420 | static struct GNUNET_ATS_SolverFunctions sf; |
2421 | struct GNUNET_ATS_PluginEnvironment *env = cls; | 2421 | struct GNUNET_ATS_PluginEnvironment *env = cls; |
2422 | struct GAS_MLP_Handle * mlp = GNUNET_new (struct GAS_MLP_Handle); | 2422 | struct GAS_MLP_Handle * mlp = GNUNET_new (struct GAS_MLP_Handle); |
2423 | |||
2424 | float f_tmp; | 2423 | float f_tmp; |
2425 | unsigned long long tmp; | 2424 | unsigned long long tmp; |
2426 | unsigned int b_min; | 2425 | unsigned int b_min; |
2427 | unsigned int n_min; | 2426 | unsigned int n_min; |
2428 | int c; | 2427 | int c; |
2429 | int c2; | ||
2430 | int found; | ||
2431 | char *outputformat; | 2428 | char *outputformat; |
2432 | 2429 | ||
2433 | struct GNUNET_TIME_Relative max_duration; | 2430 | struct GNUNET_TIME_Relative max_duration; |
@@ -2740,77 +2737,55 @@ libgnunet_plugin_ats_mlp_init (void *cls) | |||
2740 | n_min = MLP_DEFAULT_MIN_CONNECTIONS; | 2737 | n_min = MLP_DEFAULT_MIN_CONNECTIONS; |
2741 | 2738 | ||
2742 | /* Init network quotas */ | 2739 | /* Init network quotas */ |
2743 | int quotas[GNUNET_ATS_NetworkTypeCount] = GNUNET_ATS_NetworkType; | ||
2744 | for (c = 0; c < GNUNET_ATS_NetworkTypeCount; c++) | 2740 | for (c = 0; c < GNUNET_ATS_NetworkTypeCount; c++) |
2745 | { | 2741 | { |
2746 | found = GNUNET_NO; | 2742 | mlp->pv.quota_index[c] = c; |
2747 | for (c2 = 0; c2 < env->network_count; c2++) | 2743 | mlp->pv.quota_out[c] = env->out_quota[c]; |
2748 | { | 2744 | mlp->pv.quota_in[c] = env->in_quota[c]; |
2749 | if (quotas[c] == env->networks[c2]) | ||
2750 | { | ||
2751 | mlp->pv.quota_index[c] = env->networks[c2]; | ||
2752 | mlp->pv.quota_out[c] = env->out_quota[c2]; | ||
2753 | mlp->pv.quota_in[c] = env->in_quota[c2]; | ||
2754 | |||
2755 | found = GNUNET_YES; | ||
2756 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
2757 | "Quota for network `%s' (in/out) %llu/%llu\n", | ||
2758 | GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]), | ||
2759 | mlp->pv.quota_out[c], | ||
2760 | mlp->pv.quota_in[c]); | ||
2761 | break; | ||
2762 | |||
2763 | } | ||
2764 | } | ||
2765 | |||
2766 | /* Check if defined quota could make problem unsolvable */ | ||
2767 | if ((n_min * b_min) > mlp->pv.quota_out[c]) | ||
2768 | { | ||
2769 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
2770 | _("Adjusting inconsistent outbound quota configuration for network `%s', is %llu must be at least %llu\n"), | ||
2771 | GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]), | ||
2772 | mlp->pv.quota_out[c], | ||
2773 | (n_min * b_min)); | ||
2774 | mlp->pv.quota_out[c] = (n_min * b_min); | ||
2775 | } | ||
2776 | if ((n_min * b_min) > mlp->pv.quota_in[c]) | ||
2777 | { | ||
2778 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
2779 | _("Adjusting inconsistent inbound quota configuration for network `%s', is %llu must be at least %llu\n"), | ||
2780 | GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]), | ||
2781 | mlp->pv.quota_in[c], | ||
2782 | (n_min * b_min)); | ||
2783 | mlp->pv.quota_in[c] = (n_min * b_min); | ||
2784 | } | ||
2785 | |||
2786 | /* Check if bandwidth is too big to make problem solvable */ | ||
2787 | if (mlp->pv.BIG_M < mlp->pv.quota_out[c]) | ||
2788 | { | ||
2789 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
2790 | _("Adjusting outbound quota configuration for network `%s'from %llu to %.0f\n"), | ||
2791 | GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]), | ||
2792 | mlp->pv.quota_out[c], | ||
2793 | mlp->pv.BIG_M); | ||
2794 | mlp->pv.quota_out[c] = mlp->pv.BIG_M ; | ||
2795 | } | ||
2796 | if (mlp->pv.BIG_M < mlp->pv.quota_in[c]) | ||
2797 | { | ||
2798 | LOG (GNUNET_ERROR_TYPE_INFO, _("Adjusting inbound quota configuration for network `%s' from %llu to %.0f\n"), | ||
2799 | GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]), | ||
2800 | mlp->pv.quota_in[c], | ||
2801 | mlp->pv.BIG_M); | ||
2802 | mlp->pv.quota_in[c] = mlp->pv.BIG_M ; | ||
2803 | } | ||
2804 | 2745 | ||
2805 | if (GNUNET_NO == found) | 2746 | LOG (GNUNET_ERROR_TYPE_INFO, |
2806 | { | 2747 | "Quota for network `%s' (in/out) %llu/%llu\n", |
2807 | mlp->pv.quota_in[c] = ntohl (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__); | 2748 | GNUNET_ATS_print_network_type (c), |
2808 | mlp->pv.quota_out[c] = ntohl (GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT.value__); | 2749 | mlp->pv.quota_out[c], |
2809 | LOG (GNUNET_ERROR_TYPE_INFO, _("Using default quota configuration for network `%s' (in/out) %llu/%llu\n"), | 2750 | mlp->pv.quota_in[c]); |
2810 | GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]), | 2751 | /* Check if defined quota could make problem unsolvable */ |
2811 | mlp->pv.quota_in[c], | 2752 | if ((n_min * b_min) > mlp->pv.quota_out[c]) |
2812 | mlp->pv.quota_out[c]); | 2753 | { |
2813 | } | 2754 | LOG (GNUNET_ERROR_TYPE_INFO, |
2755 | _("Adjusting inconsistent outbound quota configuration for network `%s', is %llu must be at least %llu\n"), | ||
2756 | GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]), | ||
2757 | mlp->pv.quota_out[c], | ||
2758 | (n_min * b_min)); | ||
2759 | mlp->pv.quota_out[c] = (n_min * b_min); | ||
2760 | } | ||
2761 | if ((n_min * b_min) > mlp->pv.quota_in[c]) | ||
2762 | { | ||
2763 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
2764 | _("Adjusting inconsistent inbound quota configuration for network `%s', is %llu must be at least %llu\n"), | ||
2765 | GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]), | ||
2766 | mlp->pv.quota_in[c], | ||
2767 | (n_min * b_min)); | ||
2768 | mlp->pv.quota_in[c] = (n_min * b_min); | ||
2769 | } | ||
2770 | /* Check if bandwidth is too big to make problem solvable */ | ||
2771 | if (mlp->pv.BIG_M < mlp->pv.quota_out[c]) | ||
2772 | { | ||
2773 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
2774 | _("Adjusting outbound quota configuration for network `%s'from %llu to %.0f\n"), | ||
2775 | GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]), | ||
2776 | mlp->pv.quota_out[c], | ||
2777 | mlp->pv.BIG_M); | ||
2778 | mlp->pv.quota_out[c] = mlp->pv.BIG_M ; | ||
2779 | } | ||
2780 | if (mlp->pv.BIG_M < mlp->pv.quota_in[c]) | ||
2781 | { | ||
2782 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
2783 | _("Adjusting inbound quota configuration for network `%s' from %llu to %.0f\n"), | ||
2784 | GNUNET_ATS_print_network_type(mlp->pv.quota_index[c]), | ||
2785 | mlp->pv.quota_in[c], | ||
2786 | mlp->pv.BIG_M); | ||
2787 | mlp->pv.quota_in[c] = mlp->pv.BIG_M ; | ||
2788 | } | ||
2814 | } | 2789 | } |
2815 | mlp->env = env; | 2790 | mlp->env = env; |
2816 | sf.cls = mlp; | 2791 | sf.cls = mlp; |
diff --git a/src/ats/plugin_ats_proportional.c b/src/ats/plugin_ats_proportional.c index a154ceff3..32ee9f4e4 100644 --- a/src/ats/plugin_ats_proportional.c +++ b/src/ats/plugin_ats_proportional.c | |||
@@ -282,7 +282,7 @@ struct Network | |||
282 | /** | 282 | /** |
283 | * ATS network type | 283 | * ATS network type |
284 | */ | 284 | */ |
285 | unsigned int type; | 285 | enum GNUNET_ATS_Network_Type type; |
286 | 286 | ||
287 | /** | 287 | /** |
288 | * Network description | 288 | * Network description |
@@ -875,11 +875,12 @@ get_active_address (void *solver, | |||
875 | const struct GNUNET_CONTAINER_MultiPeerMap * addresses, | 875 | const struct GNUNET_CONTAINER_MultiPeerMap * addresses, |
876 | const struct GNUNET_PeerIdentity *peer) | 876 | const struct GNUNET_PeerIdentity *peer) |
877 | { | 877 | { |
878 | static struct ATS_Address * dest = NULL; | 878 | static struct ATS_Address *dest; |
879 | 879 | ||
880 | dest = NULL; | 880 | dest = NULL; |
881 | GNUNET_CONTAINER_multipeermap_get_multiple (addresses, peer, | 881 | GNUNET_CONTAINER_multipeermap_get_multiple (addresses, peer, |
882 | &get_active_address_it, &dest); | 882 | &get_active_address_it, |
883 | &dest); | ||
883 | return dest; | 884 | return dest; |
884 | } | 885 | } |
885 | 886 | ||
@@ -892,15 +893,15 @@ get_active_address (void *solver, | |||
892 | * @return the network struct | 893 | * @return the network struct |
893 | */ | 894 | */ |
894 | static struct Network * | 895 | static struct Network * |
895 | get_network (struct GAS_PROPORTIONAL_Handle *s, uint32_t type) | 896 | get_network (struct GAS_PROPORTIONAL_Handle *s, |
897 | enum GNUNET_ATS_Network_Type type) | ||
896 | { | 898 | { |
897 | int c; | 899 | if (type >= s->env->network_count) |
898 | for (c = 0; c < s->network_count; c++) | ||
899 | { | 900 | { |
900 | if (s->network_entries[c].type == type) | 901 | GNUNET_break (0); |
901 | return &s->network_entries[c]; | 902 | return NULL; |
902 | } | 903 | } |
903 | return NULL ; | 904 | return &s->network_entries[type]; |
904 | } | 905 | } |
905 | 906 | ||
906 | 907 | ||
@@ -1672,24 +1673,23 @@ GAS_proportional_address_property_changed (void *solver, | |||
1672 | static void | 1673 | static void |
1673 | GAS_proportional_address_add (void *solver, | 1674 | GAS_proportional_address_add (void *solver, |
1674 | struct ATS_Address *address, | 1675 | struct ATS_Address *address, |
1675 | uint32_t network) | 1676 | enum GNUNET_ATS_Network_Type network) |
1676 | { | 1677 | { |
1677 | struct GAS_PROPORTIONAL_Handle *s = solver; | 1678 | struct GAS_PROPORTIONAL_Handle *s = solver; |
1678 | struct Network *net = NULL; | 1679 | struct Network *net; |
1679 | struct AddressWrapper *aw = NULL; | 1680 | struct AddressWrapper *aw; |
1680 | struct AddressSolverInformation *asi; | 1681 | struct AddressSolverInformation *asi; |
1681 | 1682 | ||
1682 | GNUNET_assert(NULL != s); | ||
1683 | net = get_network (s, network); | 1683 | net = get_network (s, network); |
1684 | if (NULL == net) | 1684 | if (NULL == net) |
1685 | { | 1685 | { |
1686 | GNUNET_break(0); | 1686 | GNUNET_break (0); |
1687 | 1687 | LOG (GNUNET_ERROR_TYPE_ERROR, | |
1688 | LOG(GNUNET_ERROR_TYPE_ERROR, | 1688 | "Unknown network %u `%s' for new address %p for peer `%s'\n", |
1689 | "Unknown network %u `%s' for new address %p for peer `%s'\n", | 1689 | network, |
1690 | network, GNUNET_ATS_print_network_type(network), | 1690 | GNUNET_ATS_print_network_type (network), |
1691 | address, GNUNET_i2s(&address->peer)); | 1691 | address, |
1692 | 1692 | GNUNET_i2s (&address->peer)); | |
1693 | return; | 1693 | return; |
1694 | } | 1694 | } |
1695 | 1695 | ||
@@ -1807,7 +1807,7 @@ libgnunet_plugin_ats_proportional_init (void *cls) | |||
1807 | for (c = 0; c < env->network_count; c++) | 1807 | for (c = 0; c < env->network_count; c++) |
1808 | { | 1808 | { |
1809 | cur = &s->network_entries[c]; | 1809 | cur = &s->network_entries[c]; |
1810 | cur->type = env->networks[c]; | 1810 | cur->type = c; |
1811 | cur->total_quota_in = env->in_quota[c]; | 1811 | cur->total_quota_in = env->in_quota[c]; |
1812 | cur->total_quota_out = env->out_quota[c]; | 1812 | cur->total_quota_out = env->out_quota[c]; |
1813 | cur->desc = GNUNET_ATS_print_network_type (c); | 1813 | cur->desc = GNUNET_ATS_print_network_type (c); |
diff --git a/src/ats/plugin_ats_ril.c b/src/ats/plugin_ats_ril.c index 662935583..6718cae22 100644 --- a/src/ats/plugin_ats_ril.c +++ b/src/ats/plugin_ats_ril.c | |||
@@ -2799,7 +2799,7 @@ libgnunet_plugin_ats_ril_init (void *cls) | |||
2799 | for (c = 0; c < env->network_count; c++) | 2799 | for (c = 0; c < env->network_count; c++) |
2800 | { | 2800 | { |
2801 | cur = &solver->network_entries[c]; | 2801 | cur = &solver->network_entries[c]; |
2802 | cur->type = env->networks[c]; | 2802 | cur->type = c; |
2803 | cur->bw_in_available = env->in_quota[c]; | 2803 | cur->bw_in_available = env->in_quota[c]; |
2804 | cur->bw_out_available = env->out_quota[c]; | 2804 | cur->bw_out_available = env->out_quota[c]; |
2805 | LOG(GNUNET_ERROR_TYPE_DEBUG, "init() Quotas for %s network: IN %llu - OUT %llu\n", GNUNET_ATS_print_network_type(cur->type), cur->bw_in_available/1024, cur->bw_out_available/1024); | 2805 | LOG(GNUNET_ERROR_TYPE_DEBUG, "init() Quotas for %s network: IN %llu - OUT %llu\n", GNUNET_ATS_print_network_type(cur->type), cur->bw_in_available/1024, cur->bw_out_available/1024); |
diff --git a/src/include/gnunet_ats_plugin.h b/src/include/gnunet_ats_plugin.h index 36a49d252..bec94b31b 100644 --- a/src/include/gnunet_ats_plugin.h +++ b/src/include/gnunet_ats_plugin.h | |||
@@ -464,14 +464,10 @@ struct GNUNET_ATS_PluginEnvironment | |||
464 | GAS_solver_information_callback info_cb; | 464 | GAS_solver_information_callback info_cb; |
465 | 465 | ||
466 | /** | 466 | /** |
467 | * Available networks | 467 | * Number of networks available, size of the @e out_quota |
468 | * and @e in_quota arrays. | ||
468 | */ | 469 | */ |
469 | int networks[GNUNET_ATS_NetworkTypeCount]; | 470 | unsigned int network_count; |
470 | |||
471 | /** | ||
472 | * Number of networks available | ||
473 | */ | ||
474 | int network_count; | ||
475 | 471 | ||
476 | /** | 472 | /** |
477 | * Array of configured outbound quotas | 473 | * Array of configured outbound quotas |
diff --git a/src/include/gnunet_ats_service.h b/src/include/gnunet_ats_service.h index 63c560487..e4070c40f 100644 --- a/src/include/gnunet_ats_service.h +++ b/src/include/gnunet_ats_service.h | |||
@@ -31,12 +31,6 @@ | |||
31 | #include "gnunet_hello_lib.h" | 31 | #include "gnunet_hello_lib.h" |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * Number of network types supported by ATS | ||
35 | */ | ||
36 | #define GNUNET_ATS_NetworkTypeCount 6 | ||
37 | |||
38 | |||
39 | /** | ||
40 | * Types of networks (with separate quotas) we support. | 34 | * Types of networks (with separate quotas) we support. |
41 | */ | 35 | */ |
42 | enum GNUNET_ATS_Network_Type | 36 | enum GNUNET_ATS_Network_Type |
@@ -70,14 +64,13 @@ enum GNUNET_ATS_Network_Type | |||
70 | * Bluetooth LAN | 64 | * Bluetooth LAN |
71 | */ | 65 | */ |
72 | GNUNET_ATS_NET_BT = 5 | 66 | GNUNET_ATS_NET_BT = 5 |
73 | }; | ||
74 | |||
75 | 67 | ||
76 | /** | 68 | /** |
77 | * ATS network types as array initializer | 69 | * Number of network types supported by ATS |
78 | */ | 70 | */ |
79 | #define GNUNET_ATS_NetworkType { GNUNET_ATS_NET_UNSPECIFIED, GNUNET_ATS_NET_LOOPBACK, GNUNET_ATS_NET_LAN, GNUNET_ATS_NET_WAN, GNUNET_ATS_NET_WLAN, GNUNET_ATS_NET_BT } | 71 | #define GNUNET_ATS_NetworkTypeCount 6 |
80 | 72 | ||
73 | }; | ||
81 | 74 | ||
82 | 75 | ||
83 | /** | 76 | /** |