diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-04-17 14:16:38 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-04-17 14:16:38 +0000 |
commit | c95ac75360aa7be7ae3186d96903096285fc1d88 (patch) | |
tree | 833757cd737f2bc62abd959c48289d1a2ed8f91e /src/ats/gnunet-ats-solver-eval.c | |
parent | b41abaa8643a89f55f3420d9044e529d0259737b (diff) | |
download | gnunet-c95ac75360aa7be7ae3186d96903096285fc1d88.tar.gz gnunet-c95ac75360aa7be7ae3186d96903096285fc1d88.zip |
fixing shutdown
Diffstat (limited to 'src/ats/gnunet-ats-solver-eval.c')
-rw-r--r-- | src/ats/gnunet-ats-solver-eval.c | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/src/ats/gnunet-ats-solver-eval.c b/src/ats/gnunet-ats-solver-eval.c index 47e621646..1c6e6ad52 100644 --- a/src/ats/gnunet-ats-solver-eval.c +++ b/src/ats/gnunet-ats-solver-eval.c | |||
@@ -65,6 +65,11 @@ static int opt_verbose; | |||
65 | */ | 65 | */ |
66 | static int opt_print; | 66 | static int opt_print; |
67 | 67 | ||
68 | /** | ||
69 | * cmd option -d: disable normalization | ||
70 | */ | ||
71 | static int opt_disable_normalization; | ||
72 | |||
68 | static int res; | 73 | static int res; |
69 | 74 | ||
70 | static void | 75 | static void |
@@ -613,7 +618,12 @@ set_prop_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
613 | 618 | ||
614 | /* set performance here! */ | 619 | /* set performance here! */ |
615 | sh->env.sf.s_bulk_start (sh->solver); | 620 | sh->env.sf.s_bulk_start (sh->solver); |
616 | GAS_normalization_normalize_property (sh->addresses, | 621 | if (GNUNET_YES == opt_disable_normalization) |
622 | { | ||
623 | GNUNET_break (0); | ||
624 | } | ||
625 | else | ||
626 | GAS_normalization_normalize_property (sh->addresses, | ||
617 | pg->test_address->ats_addr, &atsi, 1); | 627 | pg->test_address->ats_addr, &atsi, 1); |
618 | sh->env.sf.s_bulk_stop (sh->solver); | 628 | sh->env.sf.s_bulk_stop (sh->solver); |
619 | 629 | ||
@@ -854,8 +864,13 @@ set_pref_task (void *cls, | |||
854 | GNUNET_ATS_print_preference_type (pg->kind), pref_value); | 864 | GNUNET_ATS_print_preference_type (pg->kind), pref_value); |
855 | 865 | ||
856 | sh->env.sf.s_bulk_start (sh->solver); | 866 | sh->env.sf.s_bulk_start (sh->solver); |
857 | GAS_normalization_normalize_preference (NULL + (pg->client_id), &p->peer_id, | 867 | if (GNUNET_YES == opt_disable_normalization) |
858 | pg->kind, pref_value); | 868 | { |
869 | GNUNET_break (0); | ||
870 | } | ||
871 | else | ||
872 | GAS_normalization_normalize_preference (NULL + (pg->client_id), | ||
873 | &p->peer_id, pg->kind, pref_value); | ||
859 | sh->env.sf.s_bulk_stop (sh->solver); | 874 | sh->env.sf.s_bulk_stop (sh->solver); |
860 | 875 | ||
861 | switch (pg->kind) { | 876 | switch (pg->kind) { |
@@ -2520,6 +2535,9 @@ GNUNET_ATS_solvers_solver_stop (struct SolverHandle *sh) | |||
2520 | GNUNET_STATISTICS_destroy ((struct GNUNET_STATISTICS_Handle *) sh->env.stats, | 2535 | GNUNET_STATISTICS_destroy ((struct GNUNET_STATISTICS_Handle *) sh->env.stats, |
2521 | GNUNET_NO); | 2536 | GNUNET_NO); |
2522 | GNUNET_PLUGIN_unload (sh->plugin, sh->solver); | 2537 | GNUNET_PLUGIN_unload (sh->plugin, sh->solver); |
2538 | |||
2539 | GAS_normalization_stop(); | ||
2540 | |||
2523 | GNUNET_CONTAINER_multipeermap_iterate (sh->addresses, &free_all_it, NULL); | 2541 | GNUNET_CONTAINER_multipeermap_iterate (sh->addresses, &free_all_it, NULL); |
2524 | GNUNET_CONTAINER_multipeermap_destroy(sh->addresses); | 2542 | GNUNET_CONTAINER_multipeermap_destroy(sh->addresses); |
2525 | GNUNET_free (sh->plugin); | 2543 | GNUNET_free (sh->plugin); |
@@ -2753,14 +2771,27 @@ solver_bandwidth_changed_cb (void *cls, struct ATS_Address *address) | |||
2753 | const double * | 2771 | const double * |
2754 | get_preferences_cb (void *cls, const struct GNUNET_PeerIdentity *id) | 2772 | get_preferences_cb (void *cls, const struct GNUNET_PeerIdentity *id) |
2755 | { | 2773 | { |
2756 | return GAS_normalization_get_preferences_by_peer (id); | 2774 | |
2775 | if (GNUNET_YES == opt_disable_normalization) | ||
2776 | { | ||
2777 | GNUNET_break (0); | ||
2778 | return NULL; | ||
2779 | } | ||
2780 | else | ||
2781 | return GAS_normalization_get_preferences_by_peer (id); | ||
2757 | } | 2782 | } |
2758 | 2783 | ||
2759 | 2784 | ||
2760 | const double * | 2785 | const double * |
2761 | get_property_cb (void *cls, const struct ATS_Address *address) | 2786 | get_property_cb (void *cls, const struct ATS_Address *address) |
2762 | { | 2787 | { |
2763 | return GAS_normalization_get_properties ((struct ATS_Address *) address); | 2788 | if (GNUNET_YES == opt_disable_normalization) |
2789 | { | ||
2790 | GNUNET_break (0); | ||
2791 | return NULL; | ||
2792 | } | ||
2793 | else | ||
2794 | return GAS_normalization_get_properties ((struct ATS_Address *) address); | ||
2764 | } | 2795 | } |
2765 | 2796 | ||
2766 | static void | 2797 | static void |
@@ -2962,6 +2993,7 @@ done () | |||
2962 | GNUNET_ATS_solvers_solver_stop (sh); | 2993 | GNUNET_ATS_solvers_solver_stop (sh); |
2963 | sh = NULL; | 2994 | sh = NULL; |
2964 | } | 2995 | } |
2996 | |||
2965 | /* Shutdown */ | 2997 | /* Shutdown */ |
2966 | end_now(); | 2998 | end_now(); |
2967 | } | 2999 | } |
@@ -3114,6 +3146,9 @@ main (int argc, char *argv[]) | |||
3114 | { 'f', "file", NULL, | 3146 | { 'f', "file", NULL, |
3115 | gettext_noop ("save logging to disk"), | 3147 | gettext_noop ("save logging to disk"), |
3116 | 0, &GNUNET_GETOPT_set_one, &opt_save}, | 3148 | 0, &GNUNET_GETOPT_set_one, &opt_save}, |
3149 | { 'd', "dn", NULL, | ||
3150 | gettext_noop ("disable normalization"), | ||
3151 | 0, &GNUNET_GETOPT_set_one, &opt_disable_normalization}, | ||
3117 | GNUNET_GETOPT_OPTION_END | 3152 | GNUNET_GETOPT_OPTION_END |
3118 | }; | 3153 | }; |
3119 | 3154 | ||