diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-11-18 19:19:10 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-11-18 19:19:10 +0100 |
commit | 8ea5327297c6dc43c9bea725ca10cd379533ae2c (patch) | |
tree | c71b7753076b8cf7323e7daca2932ef8a1244715 /src/rps/gnunet-service-rps.c | |
parent | 75f764ad21fd850bd068f5746b8db89d49e784d1 (diff) | |
parent | 52968789d280ee066e4527d6b191691625bd993a (diff) | |
download | gnunet-8ea5327297c6dc43c9bea725ca10cd379533ae2c.tar.gz gnunet-8ea5327297c6dc43c9bea725ca10cd379533ae2c.zip |
Merge branch 'master' of git+ssh://gnunet.org/gnunet
Diffstat (limited to 'src/rps/gnunet-service-rps.c')
-rw-r--r-- | src/rps/gnunet-service-rps.c | 117 |
1 files changed, 65 insertions, 52 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index ecbc8e208..dc4c5dab7 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -596,8 +596,10 @@ static const uint32_t num_valid_peers_max = UINT32_MAX; | |||
596 | static void | 596 | static void |
597 | do_round (void *cls); | 597 | do_round (void *cls); |
598 | 598 | ||
599 | #if ENABLE_MALICIOUS | ||
599 | static void | 600 | static void |
600 | do_mal_round (void *cls); | 601 | do_mal_round (void *cls); |
602 | #endif /* ENABLE_MALICIOUS */ | ||
601 | 603 | ||
602 | 604 | ||
603 | /** | 605 | /** |
@@ -2464,6 +2466,7 @@ resize_wrapper (struct RPS_Sampler *sampler, uint32_t new_size) | |||
2464 | } | 2466 | } |
2465 | 2467 | ||
2466 | 2468 | ||
2469 | #if ENABLE_MALICIOUS | ||
2467 | /** | 2470 | /** |
2468 | * Add all peers in @a peer_array to @a peer_map used as set. | 2471 | * Add all peers in @a peer_array to @a peer_map used as set. |
2469 | * | 2472 | * |
@@ -2500,6 +2503,7 @@ add_peer_array_to_set (const struct GNUNET_PeerIdentity *peer_array, | |||
2500 | } | 2503 | } |
2501 | } | 2504 | } |
2502 | } | 2505 | } |
2506 | #endif /* ENABLE_MALICIOUS */ | ||
2503 | 2507 | ||
2504 | 2508 | ||
2505 | /** | 2509 | /** |
@@ -2948,12 +2952,16 @@ new_sub (const struct GNUNET_HashCode *hash, | |||
2948 | 2952 | ||
2949 | /* Logging of internals */ | 2953 | /* Logging of internals */ |
2950 | #ifdef TO_FILE_FULL | 2954 | #ifdef TO_FILE_FULL |
2951 | sub->file_name_view_log = store_prefix_file_name (&own_identity, "view"); | 2955 | // FIXME: The service cannot know the index, which is required by this |
2956 | // function: | ||
2957 | // sub->file_name_view_log = store_prefix_file_name (&own_identity, "view"); | ||
2952 | #endif /* TO_FILE_FULL */ | 2958 | #endif /* TO_FILE_FULL */ |
2953 | #ifdef TO_FILE | 2959 | #ifdef TO_FILE |
2954 | #ifdef TO_FILE_FULL | 2960 | #ifdef TO_FILE_FULL |
2955 | sub->file_name_observed_log = store_prefix_file_name (&own_identity, | 2961 | // FIXME: The service cannot know the index, which is required by this |
2956 | "observed"); | 2962 | // function: |
2963 | // sub->file_name_observed_log = store_prefix_file_name (&own_identity, | ||
2964 | // "observed"); | ||
2957 | #endif /* TO_FILE_FULL */ | 2965 | #endif /* TO_FILE_FULL */ |
2958 | sub->num_observed_peers = 0; | 2966 | sub->num_observed_peers = 0; |
2959 | sub->observed_unique_peers = GNUNET_CONTAINER_multipeermap_create (1, | 2967 | sub->observed_unique_peers = GNUNET_CONTAINER_multipeermap_create (1, |
@@ -2981,46 +2989,50 @@ new_sub (const struct GNUNET_HashCode *hash, | |||
2981 | 2989 | ||
2982 | 2990 | ||
2983 | #ifdef TO_FILE | 2991 | #ifdef TO_FILE |
2984 | /** | 2992 | // /** |
2985 | * @brief Write all numbers in the given array into the given file | 2993 | // * @brief Write all numbers in the given array into the given file |
2986 | * | 2994 | // * |
2987 | * Single numbers devided by a newline | 2995 | // * Single numbers devided by a newline |
2988 | * | 2996 | // * |
2989 | * @param hist_array[] the array to dump | 2997 | // * FIXME: The call to store_prefix_file_name expects the index of the peer, |
2990 | * @param file_name file to dump into | 2998 | // * which cannot be known to the service. |
2991 | */ | 2999 | // * Write a dedicated function that uses the peer id. |
2992 | static void | 3000 | // * |
2993 | write_histogram_to_file (const uint32_t hist_array[], | 3001 | // * @param hist_array[] the array to dump |
2994 | const char *file_name) | 3002 | // * @param file_name file to dump into |
2995 | { | 3003 | // */ |
2996 | char collect_str[SIZE_DUMP_FILE + 1] = ""; | 3004 | // static void |
2997 | char *recv_str_iter; | 3005 | // write_histogram_to_file (const uint32_t hist_array[], |
2998 | char *file_name_full; | 3006 | // const char *file_name) |
2999 | 3007 | // { | |
3000 | recv_str_iter = collect_str; | 3008 | // char collect_str[SIZE_DUMP_FILE + 1] = ""; |
3001 | file_name_full = store_prefix_file_name (&own_identity, | 3009 | // char *recv_str_iter; |
3002 | file_name); | 3010 | // char *file_name_full; |
3003 | for (uint32_t i = 0; i < HISTOGRAM_FILE_SLOTS; i++) | 3011 | // |
3004 | { | 3012 | // recv_str_iter = collect_str; |
3005 | char collect_str_tmp[8]; | 3013 | // file_name_full = store_prefix_file_name (&own_identity, |
3006 | 3014 | // file_name); | |
3007 | GNUNET_snprintf (collect_str_tmp, | 3015 | // for (uint32_t i = 0; i < HISTOGRAM_FILE_SLOTS; i++) |
3008 | sizeof(collect_str_tmp), | 3016 | // { |
3009 | "%" PRIu32 "\n", | 3017 | // char collect_str_tmp[8]; |
3010 | hist_array[i]); | 3018 | // |
3011 | recv_str_iter = stpncpy (recv_str_iter, | 3019 | // GNUNET_snprintf (collect_str_tmp, |
3012 | collect_str_tmp, | 3020 | // sizeof(collect_str_tmp), |
3013 | 6); | 3021 | // "%" PRIu32 "\n", |
3014 | } | 3022 | // hist_array[i]); |
3015 | (void) stpcpy (recv_str_iter, | 3023 | // recv_str_iter = stpncpy (recv_str_iter, |
3016 | "\n"); | 3024 | // collect_str_tmp, |
3017 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 3025 | // 6); |
3018 | "Writing push stats to disk\n"); | 3026 | // } |
3019 | to_file_w_len (file_name_full, | 3027 | // (void) stpcpy (recv_str_iter, |
3020 | SIZE_DUMP_FILE, "%s", | 3028 | // "\n"); |
3021 | collect_str); | 3029 | // LOG (GNUNET_ERROR_TYPE_DEBUG, |
3022 | GNUNET_free (file_name_full); | 3030 | // "Writing push stats to disk\n"); |
3023 | } | 3031 | // to_file_w_len (file_name_full, |
3032 | // SIZE_DUMP_FILE, "%s", | ||
3033 | // collect_str); | ||
3034 | // GNUNET_free (file_name_full); | ||
3035 | // } | ||
3024 | 3036 | ||
3025 | 3037 | ||
3026 | #endif /* TO_FILE */ | 3038 | #endif /* TO_FILE */ |
@@ -3065,17 +3077,18 @@ destroy_sub (struct Sub *sub) | |||
3065 | sub->file_name_observed_log = NULL; | 3077 | sub->file_name_observed_log = NULL; |
3066 | #endif /* TO_FILE_FULL */ | 3078 | #endif /* TO_FILE_FULL */ |
3067 | 3079 | ||
3068 | /* Write push frequencies to disk */ | 3080 | // FIXME: Currently this calls malfunctionning code |
3069 | write_histogram_to_file (sub->push_recv, | 3081 | // /* Write push frequencies to disk */ |
3070 | "push_recv"); | 3082 | // write_histogram_to_file (sub->push_recv, |
3083 | // "push_recv"); | ||
3071 | 3084 | ||
3072 | /* Write push deltas to disk */ | 3085 | // /* Write push deltas to disk */ |
3073 | write_histogram_to_file (sub->push_delta, | 3086 | // write_histogram_to_file (sub->push_delta, |
3074 | "push_delta"); | 3087 | // "push_delta"); |
3075 | 3088 | ||
3076 | /* Write pull delays to disk */ | 3089 | // /* Write pull delays to disk */ |
3077 | write_histogram_to_file (sub->pull_delays, | 3090 | // write_histogram_to_file (sub->pull_delays, |
3078 | "pull_delays"); | 3091 | // "pull_delays"); |
3079 | 3092 | ||
3080 | GNUNET_CONTAINER_multipeermap_destroy (sub->observed_unique_peers); | 3093 | GNUNET_CONTAINER_multipeermap_destroy (sub->observed_unique_peers); |
3081 | sub->observed_unique_peers = NULL; | 3094 | sub->observed_unique_peers = NULL; |