diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-02-26 09:25:04 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-02-26 09:25:04 +0100 |
commit | c55c08bd1e45ea3ce5f4a659344e0bbb0ad8c294 (patch) | |
tree | 0a711f4f0aca9ed6cfd5bf806a2ac666b1247085 /src | |
parent | 3495689e26efb8f9690945d3c7f4cd68eaeaaf86 (diff) | |
download | gnunet-c55c08bd1e45ea3ce5f4a659344e0bbb0ad8c294.tar.gz gnunet-c55c08bd1e45ea3ce5f4a659344e0bbb0ad8c294.zip |
fix profiler crash on bad startup
Diffstat (limited to 'src')
-rw-r--r-- | src/rps/gnunet-rps-profiler.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c index 8e6fa389a..cdf555432 100644 --- a/src/rps/gnunet-rps-profiler.c +++ b/src/rps/gnunet-rps-profiler.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
@@ -2831,7 +2831,8 @@ run (void *cls, | |||
2831 | 2831 | ||
2832 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "This is the profiler\n"); | 2832 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "This is the profiler\n"); |
2833 | cur_test_run.name = "test-rps-profiler"; | 2833 | cur_test_run.name = "test-rps-profiler"; |
2834 | if (0 == num_peers) num_peers = 10; | 2834 | if (0 == num_peers) |
2835 | num_peers = 10; | ||
2835 | mal_type = 3; | 2836 | mal_type = 3; |
2836 | cur_test_run.init_peer = profiler_init_peer; | 2837 | cur_test_run.init_peer = profiler_init_peer; |
2837 | //cur_test_run.pre_test = mal_pre; | 2838 | //cur_test_run.pre_test = mal_pre; |
@@ -2957,25 +2958,21 @@ main (int argc, char *argv[]) | |||
2957 | "COUNT", | 2958 | "COUNT", |
2958 | gettext_noop ("number of peers to start"), | 2959 | gettext_noop ("number of peers to start"), |
2959 | &num_peers), | 2960 | &num_peers), |
2960 | |||
2961 | GNUNET_GETOPT_option_relative_time ('d', | 2961 | GNUNET_GETOPT_option_relative_time ('d', |
2962 | "duration", | 2962 | "duration", |
2963 | "DURATION", | 2963 | "DURATION", |
2964 | gettext_noop ("duration of the profiling"), | 2964 | gettext_noop ("duration of the profiling"), |
2965 | &duration), | 2965 | &duration), |
2966 | |||
2967 | GNUNET_GETOPT_option_relative_time ('t', | 2966 | GNUNET_GETOPT_option_relative_time ('t', |
2968 | "timeout", | 2967 | "timeout", |
2969 | "TIMEOUT", | 2968 | "TIMEOUT", |
2970 | gettext_noop ("timeout for the profiling"), | 2969 | gettext_noop ("timeout for the profiling"), |
2971 | &timeout), | 2970 | &timeout), |
2972 | |||
2973 | GNUNET_GETOPT_option_uint ('r', | 2971 | GNUNET_GETOPT_option_uint ('r', |
2974 | "num-requests", | 2972 | "num-requests", |
2975 | "COUNT", | 2973 | "COUNT", |
2976 | gettext_noop ("number of PeerIDs to request"), | 2974 | gettext_noop ("number of PeerIDs to request"), |
2977 | &cur_test_run.num_requests), | 2975 | &cur_test_run.num_requests), |
2978 | |||
2979 | GNUNET_GETOPT_OPTION_END | 2976 | GNUNET_GETOPT_OPTION_END |
2980 | }; | 2977 | }; |
2981 | 2978 | ||
@@ -2995,22 +2992,24 @@ main (int argc, char *argv[]) | |||
2995 | { | 2992 | { |
2996 | ret_value = 1; | 2993 | ret_value = 1; |
2997 | } | 2994 | } |
2998 | if (GNUNET_OK != ret_value) | 2995 | if (0 != ret_value) |
2999 | { | 2996 | { |
3000 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 2997 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
3001 | "Test did not run successfully!\n"); | 2998 | "Test did not run successfully!\n"); |
3002 | } | 2999 | } |
3003 | 3000 | else | |
3004 | ret_value = cur_test_run.eval_cb(); | ||
3005 | if (NO_COLLECT_VIEW == cur_test_run.have_collect_view) | ||
3006 | { | 3001 | { |
3007 | GNUNET_array_grow (rps_peers->cur_view, | 3002 | ret_value = cur_test_run.eval_cb(); |
3008 | rps_peers->cur_view_count, | 3003 | if (NO_COLLECT_VIEW == cur_test_run.have_collect_view) |
3009 | 0); | 3004 | { |
3005 | GNUNET_array_grow (rps_peers->cur_view, | ||
3006 | rps_peers->cur_view_count, | ||
3007 | 0); | ||
3008 | } | ||
3009 | GNUNET_free (rps_peers); | ||
3010 | GNUNET_free (rps_peer_ids); | ||
3011 | GNUNET_CONTAINER_multipeermap_destroy (peer_map); | ||
3010 | } | 3012 | } |
3011 | GNUNET_free (rps_peers); | ||
3012 | GNUNET_free (rps_peer_ids); | ||
3013 | GNUNET_CONTAINER_multipeermap_destroy (peer_map); | ||
3014 | return ret_value; | 3013 | return ret_value; |
3015 | } | 3014 | } |
3016 | 3015 | ||