gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] 01/02: rps: comment ill-defined code


From: gnunet
Subject: [gnunet] 01/02: rps: comment ill-defined code
Date: Mon, 16 Nov 2020 23:59:06 +0100

This is an automated email from the git hooks/post-receive script.

julius-buenger pushed a commit to branch master
in repository gnunet.

commit d30ec0f1fb9ced559b8add2f48eda05a8b58fac0
Author: Julius Bünger <buenger@mytum.de>
AuthorDate: Mon Nov 16 23:36:12 2020 +0100

    rps: comment ill-defined code
---
 src/rps/gnunet-service-rps.c | 113 +++++++++++++++++++++++--------------------
 1 file 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,
 
   /* Logging of internals */
 #ifdef TO_FILE_FULL
-  sub->file_name_view_log = store_prefix_file_name (&own_identity, "view");
+  // FIXME: The service cannot know the index, which is required by this
+  // function:
+  // sub->file_name_view_log = store_prefix_file_name (&own_identity, "view");
 #endif /* TO_FILE_FULL */
 #ifdef TO_FILE
 #ifdef TO_FILE_FULL
-  sub->file_name_observed_log = store_prefix_file_name (&own_identity,
-                                                        "observed");
+  // FIXME: The service cannot know the index, which is required by this
+  // function:
+  // sub->file_name_observed_log = store_prefix_file_name (&own_identity,
+  //                                                       "observed");
 #endif /* TO_FILE_FULL */
   sub->num_observed_peers = 0;
   sub->observed_unique_peers = GNUNET_CONTAINER_multipeermap_create (1,
@@ -2983,46 +2987,50 @@ new_sub (const struct GNUNET_HashCode *hash,
 
 
 #ifdef TO_FILE
-/**
- * @brief Write all numbers in the given array into the given file
- *
- * Single numbers devided by a newline
- *
- * @param hist_array[] the array to dump
- * @param file_name file to dump into
- */
-static void
-write_histogram_to_file (const uint32_t hist_array[],
-                         const char *file_name)
-{
-  char collect_str[SIZE_DUMP_FILE + 1] = "";
-  char *recv_str_iter;
-  char *file_name_full;
-
-  recv_str_iter = collect_str;
-  file_name_full = store_prefix_file_name (&own_identity,
-                                           file_name);
-  for (uint32_t i = 0; i < HISTOGRAM_FILE_SLOTS; i++)
-  {
-    char collect_str_tmp[8];
-
-    GNUNET_snprintf (collect_str_tmp,
-                     sizeof(collect_str_tmp),
-                     "%" PRIu32 "\n",
-                     hist_array[i]);
-    recv_str_iter = stpncpy (recv_str_iter,
-                             collect_str_tmp,
-                             6);
-  }
-  (void) stpcpy (recv_str_iter,
-                 "\n");
-  LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Writing push stats to disk\n");
-  to_file_w_len (file_name_full,
-                 SIZE_DUMP_FILE, "%s",
-                 collect_str);
-  GNUNET_free (file_name_full);
-}
+// /**
+//  * @brief Write all numbers in the given array into the given file
+//  *
+//  * Single numbers devided by a newline
+//  *
+//  * FIXME: The call to store_prefix_file_name expects the index of the peer,
+//  * which cannot be known to the service.
+//  * Write a dedicated function that uses the peer id.
+//  *
+//  * @param hist_array[] the array to dump
+//  * @param file_name file to dump into
+//  */
+// static void
+// write_histogram_to_file (const uint32_t hist_array[],
+//                          const char *file_name)
+// {
+//   char collect_str[SIZE_DUMP_FILE + 1] = "";
+//   char *recv_str_iter;
+//   char *file_name_full;
+// 
+//   recv_str_iter = collect_str;
+//   file_name_full = store_prefix_file_name (&own_identity,
+//                                            file_name);
+//   for (uint32_t i = 0; i < HISTOGRAM_FILE_SLOTS; i++)
+//   {
+//     char collect_str_tmp[8];
+// 
+//     GNUNET_snprintf (collect_str_tmp,
+//                      sizeof(collect_str_tmp),
+//                      "%" PRIu32 "\n",
+//                      hist_array[i]);
+//     recv_str_iter = stpncpy (recv_str_iter,
+//                              collect_str_tmp,
+//                              6);
+//   }
+//   (void) stpcpy (recv_str_iter,
+//                  "\n");
+//   LOG (GNUNET_ERROR_TYPE_DEBUG,
+//        "Writing push stats to disk\n");
+//   to_file_w_len (file_name_full,
+//                  SIZE_DUMP_FILE, "%s",
+//                  collect_str);
+//   GNUNET_free (file_name_full);
+// }
 
 
 #endif /* TO_FILE */
@@ -3067,17 +3075,18 @@ destroy_sub (struct Sub *sub)
   sub->file_name_observed_log = NULL;
 #endif /* TO_FILE_FULL */
 
-  /* Write push frequencies to disk */
-  write_histogram_to_file (sub->push_recv,
-                           "push_recv");
+  // FIXME: Currently this calls malfunctionning code
+  // /* Write push frequencies to disk */
+  // write_histogram_to_file (sub->push_recv,
+  //                          "push_recv");
 
-  /* Write push deltas to disk */
-  write_histogram_to_file (sub->push_delta,
-                           "push_delta");
+  // /* Write push deltas to disk */
+  // write_histogram_to_file (sub->push_delta,
+  //                          "push_delta");
 
-  /* Write pull delays to disk */
-  write_histogram_to_file (sub->pull_delays,
-                           "pull_delays");
+  // /* Write pull delays to disk */
+  // write_histogram_to_file (sub->pull_delays,
+  //                          "pull_delays");
 
   GNUNET_CONTAINER_multipeermap_destroy (sub->observed_unique_peers);
   sub->observed_unique_peers = NULL;

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]