aboutsummaryrefslogtreecommitdiff
path: root/src/rps/gnunet-service-rps.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rps/gnunet-service-rps.c')
-rw-r--r--src/rps/gnunet-service-rps.c113
1 files changed, 61 insertions, 52 deletions
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 0e3759c4c..48b5194c8 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -2950,12 +2950,16 @@ new_sub (const struct GNUNET_HashCode *hash,
2950 2950
2951 /* Logging of internals */ 2951 /* Logging of internals */
2952#ifdef TO_FILE_FULL 2952#ifdef TO_FILE_FULL
2953 sub->file_name_view_log = store_prefix_file_name (&own_identity, "view"); 2953 // FIXME: The service cannot know the index, which is required by this
2954 // function:
2955 // sub->file_name_view_log = store_prefix_file_name (&own_identity, "view");
2954#endif /* TO_FILE_FULL */ 2956#endif /* TO_FILE_FULL */
2955#ifdef TO_FILE 2957#ifdef TO_FILE
2956#ifdef TO_FILE_FULL 2958#ifdef TO_FILE_FULL
2957 sub->file_name_observed_log = store_prefix_file_name (&own_identity, 2959 // FIXME: The service cannot know the index, which is required by this
2958 "observed"); 2960 // function:
2961 // sub->file_name_observed_log = store_prefix_file_name (&own_identity,
2962 // "observed");
2959#endif /* TO_FILE_FULL */ 2963#endif /* TO_FILE_FULL */
2960 sub->num_observed_peers = 0; 2964 sub->num_observed_peers = 0;
2961 sub->observed_unique_peers = GNUNET_CONTAINER_multipeermap_create (1, 2965 sub->observed_unique_peers = GNUNET_CONTAINER_multipeermap_create (1,
@@ -2983,46 +2987,50 @@ new_sub (const struct GNUNET_HashCode *hash,
2983 2987
2984 2988
2985#ifdef TO_FILE 2989#ifdef TO_FILE
2986/** 2990// /**
2987 * @brief Write all numbers in the given array into the given file 2991// * @brief Write all numbers in the given array into the given file
2988 * 2992// *
2989 * Single numbers devided by a newline 2993// * Single numbers devided by a newline
2990 * 2994// *
2991 * @param hist_array[] the array to dump 2995// * FIXME: The call to store_prefix_file_name expects the index of the peer,
2992 * @param file_name file to dump into 2996// * which cannot be known to the service.
2993 */ 2997// * Write a dedicated function that uses the peer id.
2994static void 2998// *
2995write_histogram_to_file (const uint32_t hist_array[], 2999// * @param hist_array[] the array to dump
2996 const char *file_name) 3000// * @param file_name file to dump into
2997{ 3001// */
2998 char collect_str[SIZE_DUMP_FILE + 1] = ""; 3002// static void
2999 char *recv_str_iter; 3003// write_histogram_to_file (const uint32_t hist_array[],
3000 char *file_name_full; 3004// const char *file_name)
3001 3005// {
3002 recv_str_iter = collect_str; 3006// char collect_str[SIZE_DUMP_FILE + 1] = "";
3003 file_name_full = store_prefix_file_name (&own_identity, 3007// char *recv_str_iter;
3004 file_name); 3008// char *file_name_full;
3005 for (uint32_t i = 0; i < HISTOGRAM_FILE_SLOTS; i++) 3009//
3006 { 3010// recv_str_iter = collect_str;
3007 char collect_str_tmp[8]; 3011// file_name_full = store_prefix_file_name (&own_identity,
3008 3012// file_name);
3009 GNUNET_snprintf (collect_str_tmp, 3013// for (uint32_t i = 0; i < HISTOGRAM_FILE_SLOTS; i++)
3010 sizeof(collect_str_tmp), 3014// {
3011 "%" PRIu32 "\n", 3015// char collect_str_tmp[8];
3012 hist_array[i]); 3016//
3013 recv_str_iter = stpncpy (recv_str_iter, 3017// GNUNET_snprintf (collect_str_tmp,
3014 collect_str_tmp, 3018// sizeof(collect_str_tmp),
3015 6); 3019// "%" PRIu32 "\n",
3016 } 3020// hist_array[i]);
3017 (void) stpcpy (recv_str_iter, 3021// recv_str_iter = stpncpy (recv_str_iter,
3018 "\n"); 3022// collect_str_tmp,
3019 LOG (GNUNET_ERROR_TYPE_DEBUG, 3023// 6);
3020 "Writing push stats to disk\n"); 3024// }
3021 to_file_w_len (file_name_full, 3025// (void) stpcpy (recv_str_iter,
3022 SIZE_DUMP_FILE, "%s", 3026// "\n");
3023 collect_str); 3027// LOG (GNUNET_ERROR_TYPE_DEBUG,
3024 GNUNET_free (file_name_full); 3028// "Writing push stats to disk\n");
3025} 3029// to_file_w_len (file_name_full,
3030// SIZE_DUMP_FILE, "%s",
3031// collect_str);
3032// GNUNET_free (file_name_full);
3033// }
3026 3034
3027 3035
3028#endif /* TO_FILE */ 3036#endif /* TO_FILE */
@@ -3067,17 +3075,18 @@ destroy_sub (struct Sub *sub)
3067 sub->file_name_observed_log = NULL; 3075 sub->file_name_observed_log = NULL;
3068#endif /* TO_FILE_FULL */ 3076#endif /* TO_FILE_FULL */
3069 3077
3070 /* Write push frequencies to disk */ 3078 // FIXME: Currently this calls malfunctionning code
3071 write_histogram_to_file (sub->push_recv, 3079 // /* Write push frequencies to disk */
3072 "push_recv"); 3080 // write_histogram_to_file (sub->push_recv,
3081 // "push_recv");
3073 3082
3074 /* Write push deltas to disk */ 3083 // /* Write push deltas to disk */
3075 write_histogram_to_file (sub->push_delta, 3084 // write_histogram_to_file (sub->push_delta,
3076 "push_delta"); 3085 // "push_delta");
3077 3086
3078 /* Write pull delays to disk */ 3087 // /* Write pull delays to disk */
3079 write_histogram_to_file (sub->pull_delays, 3088 // write_histogram_to_file (sub->pull_delays,
3080 "pull_delays"); 3089 // "pull_delays");
3081 3090
3082 GNUNET_CONTAINER_multipeermap_destroy (sub->observed_unique_peers); 3091 GNUNET_CONTAINER_multipeermap_destroy (sub->observed_unique_peers);
3083 sub->observed_unique_peers = NULL; 3092 sub->observed_unique_peers = NULL;