gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] 130/164: Cleaned some more warnings


From: gnunet
Subject: [gnunet] 130/164: Cleaned some more warnings
Date: Fri, 30 Jul 2021 15:33:16 +0200

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

grothoff pushed a commit to branch master
in repository gnunet.

commit a4530df23c1d93bed0b8cb665111167fb39a49b4
Author: Elias Summermatter <elias.summermatter@seccom.ch>
AuthorDate: Wed Jun 2 22:21:28 2021 +0200

    Cleaned some more warnings
---
 src/setu/gnunet-service-setu.c |   1 +
 src/setu/ibf.c                 |   5 +-
 src/setu/ibf.h                 |  35 +++++++++++++
 src/setu/perf_setu_api.c       | 112 ++++++++++-------------------------------
 src/setu/test_setu_api.c       |  69 -------------------------
 5 files changed, 64 insertions(+), 158 deletions(-)

diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c
index b59ccad25..f7e08f859 100644
--- a/src/setu/gnunet-service-setu.c
+++ b/src/setu/gnunet-service-setu.c
@@ -4576,6 +4576,7 @@ channel_window_cb (void *cls,
  * @param cls client that sent the message
  * @param msg message sent by the client
  */
+
 static void
 handle_client_listen (void *cls,
                       const struct GNUNET_SETU_ListenMessage *msg)
diff --git a/src/setu/ibf.c b/src/setu/ibf.c
index 9272e7dff..3a3ecb77b 100644
--- a/src/setu/ibf.c
+++ b/src/setu/ibf.c
@@ -351,7 +351,7 @@ ibf_write_slice (const struct InvertibleBloomFilter *ibf,
 
   /* pack and copy counter */
   count_dst = (uint8_t *) key_hash_dst;
-  pack_counter (ibf,start,count,count_dst,counter_max_length);
+  pack_counter (ibf,start,count,(uint8_t *)count_dst,counter_max_length);
 
 
 }
@@ -456,7 +456,6 @@ unpack_counter (const struct InvertibleBloomFilter *ibf,
   uint64_t store_bit_ctr = 0;
   uint64_t byte_ctr = 0;
 
-  uint64_t number_bytes_read = ceil ((count * counter_max_length) / 8);
   while (ibf_counter_ctr <= (count - 1))
   {
     uint8_t byte_read = buf[byte_ctr];
@@ -552,7 +551,7 @@ ibf_read_slice (const void *buf,
 
   /* copy and unpack counts  */
   count_src = (struct IBF_Count *) key_hash_src;
-  unpack_counter (ibf,start,count,count_src,counter_max_length);
+  unpack_counter (ibf,start,count,(uint8_t *) count_src,counter_max_length);
 }
 
 
diff --git a/src/setu/ibf.h b/src/setu/ibf.h
index 5bd05d0c2..49c8c4ee6 100644
--- a/src/setu/ibf.h
+++ b/src/setu/ibf.h
@@ -265,6 +265,41 @@ uint8_t
 ibf_get_max_counter(struct InvertibleBloomFilter *ibf);
 
 
+/**
+ *  Packs the counter to transmit only the smallest possible amount of bytes 
and
+ *  preventing overflow of the counter
+ * @param ibf the ibf to write
+ * @param start with which bucket to start
+ * @param count how many buckets to write
+ * @param buf buffer to write the data to
+ * @param max bit length of a counter for unpacking
+ */
+
+void
+pack_counter (const struct InvertibleBloomFilter *ibf,
+              uint32_t start,
+              uint64_t count,
+              uint8_t *buf,
+              uint8_t counter_max_length);
+
+/**
+ *  Unpacks the counter to transmit only the smallest possible amount of bytes 
and
+ *  preventing overflow of the counter
+ * @param ibf the ibf to write
+ * @param start with which bucket to start
+ * @param count how many buckets to write
+ * @param buf buffer to write the data to
+ * @param max bit length of a counter for unpacking
+ */
+
+void
+unpack_counter (const struct InvertibleBloomFilter *ibf,
+                uint32_t start,
+                uint64_t count,
+                uint8_t *buf,
+                uint8_t counter_max_length);
+
+
 #if 0                           /* keep Emacsens' auto-indent happy */
 {
 #endif
diff --git a/src/setu/perf_setu_api.c b/src/setu/perf_setu_api.c
index c55e054ab..276c39924 100644
--- a/src/setu/perf_setu_api.c
+++ b/src/setu/perf_setu_api.c
@@ -57,7 +57,7 @@ static struct GNUNET_SCHEDULER_Task *tt;
  * Handles configuration file for setu performance test
  *
  */
-static const struct GNUNET_CONFIGURATION_Handle *setu_cfg;
+static struct GNUNET_CONFIGURATION_Handle *setu_cfg;
 
 
 static void
@@ -190,30 +190,6 @@ start (void *cls)
 }
 
 
-/**
- * Initialize the second set, continue
- *
- * @param cls closure, unused
- */
-static void
-init_set2 (void *cls)
-{
-  struct GNUNET_SETU_Element element;
-
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initializing set 2\n");
-
-  element.element_type = 0;
-  element.data = "hello1";
-  element.size = strlen (element.data);
-  GNUNET_SETU_add_element (set2, &element, NULL, NULL);
-  element.data = "quux";
-  element.size = strlen (element.data);
-  GNUNET_SETU_add_element (set2, &element, NULL, NULL);
-  element.data = "baz";
-  element.size = strlen (element.data);
-  GNUNET_SETU_add_element (set2, &element, &start, NULL);
-}
-
 
 /**
  * Generate random byte stream
@@ -282,24 +258,6 @@ initRandomSets (int overlap, int set1_size, int set2_size, 
int
 }
 
 
-/**
- * Initialize the first set, continue.
- */
-static void
-init_set1 (void)
-{
-  struct GNUNET_SETU_Element element;
-
-  element.element_type = 0;
-  element.data = "hello";
-  element.size = strlen (element.data);
-  GNUNET_SETU_add_element (set1, &element, NULL, NULL);
-  element.data = "bar";
-  element.size = strlen (element.data);
-  GNUNET_SETU_add_element (set1, &element, &init_set2, NULL);
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized set 1\n");
-}
-
 
 /**
  * Function run on timeout.
@@ -443,10 +401,6 @@ run_petf_thread (int total_runs)
   {
     for (int id = 0; id < core_count; id++)
     {
-      perf_thread ();
-      processed += 1;
-    }
-    /**
         if(processed >= total_runs) break;
 
         if ((child_pid = fork()) == 0) {
@@ -455,7 +409,7 @@ run_petf_thread (int total_runs)
         }
         processed += 1;
     }
-    while ((wpid = wait(&status)) > 0);**/
+    while ((wpid = wait(&status)) > 0);
   }
 }
 
@@ -469,9 +423,6 @@ execute_perf ()
   */
   remove ("perf_stats.csv");
   remove ("perf_failure_bucket_number_factor.csv");
-  // FILE *out = fopen("perfstats.log", "w");
-  // fprintf(out, "se_diff,active_passive_switches,bytes_transmitted,rtt\n");
-  int full_diff_ctr = 0;
   for (int out_out_ctr = 3; out_out_ctr <= 3; out_out_ctr++)
   {
 
@@ -480,42 +431,31 @@ execute_perf ()
       float base = 0.1;
       float x = out_ctr * base;
       char factor[10];
-      gcvt (x, 4, factor);
-
-      char tradeoff[10] = "200000";
-      if ((full_diff_ctr % 2) == 1)
-      {
-        gcvt (0.25, 4, tradeoff);
-      }
-      else
-      {
-
-      }
-      full_diff_ctr++;
-
-      setu_cfg = GNUNET_CONFIGURATION_create ();
-      GNUNET_CONFIGURATION_set_value_string (setu_cfg, "IBF",
-                                             "BUCKET_NUMBER_FACTOR", factor);  
                     // Factor default=4
-      GNUNET_CONFIGURATION_set_value_number (setu_cfg, "IBF",
-                                             "NUMBER_PER_BUCKET", 3);          
             // K default=4
-      GNUNET_CONFIGURATION_set_value_string (setu_cfg, "PERFORMANCE",
-                                             "TRADEOFF", "0");                 
              // default=0.25
-      GNUNET_CONFIGURATION_set_value_string (setu_cfg, "PERFORMANCE",
-                                             
"MAX_SET_DIFF_FACTOR_DIFFERENTIAL",
-                                             "20000");     // default=0.25
-      GNUNET_CONFIGURATION_set_value_number (setu_cfg, "BOUNDARIES",
-                                             "UPPER_ELEMENT",5000);
-
-
-      if (GNUNET_OK != GNUNET_CONFIGURATION_write (setu_cfg, "perf_setu.conf"))
-        GNUNET_log (
-          GNUNET_ERROR_TYPE_ERROR,
-          _ ("Failed to write subsystem default identifier map to `%s'.\n"),
-          setu_cfg);
-      run_petf_thread (101000);
-    }
+      char *buffer = gcvt (x, 4, factor);
+      setu_cfg = GNUNET_CONFIGURATION_create();
+      GNUNET_CONFIGURATION_set_value_string(setu_cfg, "IBF",
+                                            "BUCKET_NUMBER_FACTOR",
+                                            buffer);                       // 
Factor default=4
+      GNUNET_CONFIGURATION_set_value_number(setu_cfg, "IBF",
+                                            "NUMBER_PER_BUCKET", 3);           
            // K default=4
+      GNUNET_CONFIGURATION_set_value_string(setu_cfg, "PERFORMANCE",
+                                            "TRADEOFF", "2");                  
             // default=0.25
+      GNUNET_CONFIGURATION_set_value_string(setu_cfg, "PERFORMANCE",
+                                            "MAX_SET_DIFF_FACTOR_DIFFERENTIAL",
+                                            "20000");     // default=0.25
+      GNUNET_CONFIGURATION_set_value_number(setu_cfg, "BOUNDARIES",
+                                            "UPPER_ELEMENT", 5000);
+
+
+      if (GNUNET_OK != GNUNET_CONFIGURATION_write(setu_cfg, "perf_setu.conf"))
+          GNUNET_log(
+                  GNUNET_ERROR_TYPE_ERROR,
+                  _("Failed to write subsystem default identifier map'.\n"));
+      run_petf_thread(101000);
   }
-  return 0;
+
+  }
+  return;
 }
 
 
diff --git a/src/setu/test_setu_api.c b/src/setu/test_setu_api.c
index 008292376..5a0c9d70d 100644
--- a/src/setu/test_setu_api.c
+++ b/src/setu/test_setu_api.c
@@ -205,73 +205,6 @@ init_set2 (void *cls)
 }
 
 
-/**
- * Generate random byte stream
- */
-
-unsigned char *
-gen_rdm_bytestream (size_t num_bytes)
-{
-  unsigned char *stream = GNUNET_malloc (num_bytes);
-  GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, stream, num_bytes);
-  return stream;
-}
-
-
-/**
- * Generate random sets
- */
-
-static void
-initRandomSets (int overlap, int set1_size, int set2_size, int
-                element_size_in_bytes)
-{
-  struct GNUNET_SETU_Element element;
-  element.element_type = 0;
-
-  // Add elements to both sets
-  for (int i = 0; i < overlap; i++)
-  {
-    element.data = gen_rdm_bytestream (element_size_in_bytes);
-    element.size = element_size_in_bytes;
-    GNUNET_SETU_add_element (set1, &element, NULL, NULL);
-    GNUNET_SETU_add_element (set2, &element, NULL, NULL);
-    set1_size--;
-    set2_size--;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized elements in both sets\n");
-
-  // Add other elements to set 1
-  while (set1_size>0)
-  {
-    element.data = gen_rdm_bytestream (element_size_in_bytes);
-    element.size = element_size_in_bytes;
-    GNUNET_SETU_add_element (set1, &element, NULL, NULL);
-    set1_size--;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized elements in set1\n");
-
-  // Add other elements to set 2
-  while (set2_size > 0)
-  {
-    element.data = gen_rdm_bytestream (element_size_in_bytes);
-    element.size = element_size_in_bytes;
-
-    if (set2_size != 1)
-    {
-      GNUNET_SETU_add_element (set2, &element,NULL, NULL);
-    }
-    else
-    {
-      GNUNET_SETU_add_element (set2, &element,&start, NULL);
-    }
-
-    set2_size--;
-  }
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized elements in set2\n");
-}
-
-
 /**
  * Initialize the first set, continue.
  */
@@ -404,8 +337,6 @@ run (void *cls,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Running real set-reconciliation\n");
   init_set1 ();
-  // initRandomSets(19500,20000,20000,4096);
-  // initRandomSets(19500,20000,20000,32);
 }
 
 

-- 
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]