gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] 106/164: Added configuration new configration options as api op


From: gnunet
Subject: [gnunet] 106/164: Added configuration new configration options as api options fixes memory leak
Date: Fri, 30 Jul 2021 15:32:52 +0200

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

grothoff pushed a commit to branch master
in repository gnunet.

commit 35123745b91f2720c61d5387d1cab9bdfafbcbde
Author: Elias Summermatter <elias.summermatter@seccom.ch>
AuthorDate: Sun May 23 12:46:16 2021 +0200

    Added configuration new configration options as api options fixes memory 
leak
---
 src/include/gnunet_setu_service.h | 26 ++++++++++++++++++++-
 src/setu/gnunet-service-setu.c    | 33 +++++++++++++-------------
 src/setu/perf_setu_api.c          |  2 +-
 src/setu/setu.h                   | 49 +++++++++++++++++++++++++++++++++++++++
 src/setu/setu_api.c               | 41 +++++++++++++++++++++++++++++++-
 5 files changed, 132 insertions(+), 19 deletions(-)

diff --git a/src/include/gnunet_setu_service.h 
b/src/include/gnunet_setu_service.h
index bacec9408..1d7e48402 100644
--- a/src/include/gnunet_setu_service.h
+++ b/src/include/gnunet_setu_service.h
@@ -163,7 +163,31 @@ enum GNUNET_SETU_OptionType
   /**
    * Notify client also if we are sending a value to the other peer.
    */
-  GNUNET_SETU_OPTION_SYMMETRIC = 8
+  GNUNET_SETU_OPTION_SYMMETRIC = 8,
+
+  /**
+   * Byzantine upper bound. Is the maximal plausible number of elements
+   * a peer can have default max uint64
+   */
+  GNUNET_SETU_OPTION_CUSTOM_BYZANTINE_UPPER_BOUND = 16,
+
+  /**
+   * Bandwidth latency tradeoff determines how much bytes a single RTT is
+   * worth, which is a performance setting
+   */
+  GNUNET_SETU_OPTION_CUSTOM_BANDWIDTH_LATENCY_TRADEOFF= 32,
+
+   /**
+   * The factor determines the number of buckets an IBF has which is
+   * multiplied by the estimated setsize default: 2
+   */
+    GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKET_NUMBER_FACTOR= 64,
+
+   /**
+   * This setting determines to how many IBF buckets an single elements
+   * is mapped to.
+   */
+    GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKETS_PER_ELEMENT= 128
 };
 
 
diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c
index 6bf3d8912..8e0900af9 100644
--- a/src/setu/gnunet-service-setu.c
+++ b/src/setu/gnunet-service-setu.c
@@ -430,13 +430,7 @@ struct Operation
   /**
   * User defined Bandwidth Round Trips Tradeoff
   */
-  float rtt_bandwidth_tradeoff;
-
-  /**
-  * Factor (0-1) defines until which estimated set difference
-  * a differential sync is faster
-  */
-  float max_set_diff_factor_diff_sync;
+  uint64_t rtt_bandwidth_tradeoff;
 
 
    /**
@@ -449,7 +443,7 @@ struct Operation
    * Set difference is multiplied with this factor
    * to gennerate large enought IBF
    */
-  float ibf_bucket_number_factor;
+  uint64_t ibf_bucket_number_factor;
 
   /**
    *  Defines which site a client is
@@ -809,7 +803,7 @@ struct message_control_flow_element
 static void
 load_config(struct Operation * op) {
 
-
+    /**
     setu_cfg = GNUNET_CONFIGURATION_create();
     GNUNET_CONFIGURATION_load(setu_cfg,"perf_setu.conf");
 
@@ -821,15 +815,15 @@ load_config(struct Operation * op) {
     GNUNET_CONFIGURATION_get_value_number(setu_cfg,"IBF", "NUMBER_PER_BUCKET", 
&number);
     op->ibf_number_buckets_per_element = number;
 
-    GNUNET_CONFIGURATION_get_value_float(setu_cfg,"PERFORMANCE", "TRADEOFF", 
&fl);
-    op->rtt_bandwidth_tradeoff = fl;
+    GNUNET_CONFIGURATION_get_value_number(setu_cfg,"PERFORMANCE", "TRADEOFF", 
&number);
+    op->rtt_bandwidth_tradeoff = number;
 
     GNUNET_CONFIGURATION_get_value_float(setu_cfg,"PERFORMANCE", 
"MAX_SET_DIFF_FACTOR_DIFFERENTIAL", &fl);
     op->max_set_diff_factor_diff_sync = fl;
 
     GNUNET_CONFIGURATION_get_value_number(setu_cfg,"BOUNDARIES", 
"UPPER_ELEMENT", &number);
     op->upper_element_boundary = number;
-
+    **/
     op->peer_site = 0;
     op->active_passive_switches = 0;
 }
@@ -1165,7 +1159,7 @@ create_randomized_element_iterator (void *cls,
     struct GNUNET_SETU_Element *element = value;
 
     struct GNUNET_HashContext *hashed_key_context = 
GNUNET_CRYPTO_hash_context_start ();
-    struct GNUNET_HashCode *new_key = (struct GNUNET_HashCode*) 
GNUNET_malloc(sizeof(struct GNUNET_HashCode));
+    struct GNUNET_HashCode new_key;
     GNUNET_CRYPTO_hash_context_read (hashed_key_context,
                                      &key,
                                      sizeof(struct IBF_Key));
@@ -1173,8 +1167,8 @@ create_randomized_element_iterator (void *cls,
                                     
&op->set->content->elements_randomized_salt,
                                     sizeof(uint32_t));
     GNUNET_CRYPTO_hash_context_finish (hashed_key_context,
-                                       new_key);
-    
GNUNET_CONTAINER_multihashmap_put(op->set->content->elements_randomized,new_key,value,GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE);
+                                       &new_key);
+    
GNUNET_CONTAINER_multihashmap_put(op->set->content->elements_randomized,&new_key,value,GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE);
     return GNUNET_YES;
 }
 
@@ -4365,6 +4359,10 @@ handle_client_evaluate (void *cls,
   op->force_full = msg->force_full;
   op->force_delta = msg->force_delta;
   op->symmetric = msg->symmetric;
+  op->rtt_bandwidth_tradeoff = msg->bandwidth_latency_tradeoff;
+  op->ibf_bucket_number_factor = msg->ibf_bucket_number_factor;
+  op->ibf_number_buckets_per_element = msg->ibf_number_of_buckets_per_element;
+  op->upper_element_boundary = msg->byzantine_upper_bond;
   context = GNUNET_MQ_extract_nested_mh (msg);
 
   /* create hashmap for message control */
@@ -4562,7 +4560,10 @@ handle_client_accept (void *cls,
   op->force_full = msg->force_full;
   op->force_delta = msg->force_delta;
   op->symmetric = msg->symmetric;
-
+  op->rtt_bandwidth_tradeoff = msg->bandwidth_latency_tradeoff;
+  op->ibf_bucket_number_factor = msg->ibf_bucket_number_factor;
+  op->ibf_number_buckets_per_element = msg->ibf_number_of_buckets_per_element;
+  op->upper_element_boundary = msg->byzantine_upper_bond;
   /* create hashmap for message control */
   op->message_control_flow = 
GNUNET_CONTAINER_multihashmap_create(32,GNUNET_NO);
   op->inquiries_sent = GNUNET_CONTAINER_multihashmap_create(32,GNUNET_NO);
diff --git a/src/setu/perf_setu_api.c b/src/setu/perf_setu_api.c
index bef35adb7..c6872a5be 100644
--- a/src/setu/perf_setu_api.c
+++ b/src/setu/perf_setu_api.c
@@ -460,7 +460,7 @@ static void execute_perf() {
             gcvt(x, 4, factor);
 
             char tradeoff[10] = "200000";
-            if((full_diff_ctr % 2) == 1) {
+            if((full_diff_ctr % 2) == 0) {
                 gcvt(0.25, 4, tradeoff);
             } else {
 
diff --git a/src/setu/setu.h b/src/setu/setu.h
index 7c2a98a02..32b294197 100644
--- a/src/setu/setu.h
+++ b/src/setu/setu.h
@@ -122,6 +122,31 @@ struct GNUNET_SETU_AcceptMessage
    */
   uint32_t byzantine_lower_bound;
 
+
+    /**
+     * Upper bound for the set size, used only when
+     * byzantine mode is enabled.
+     */
+    uint64_t byzantine_upper_bond;
+
+    /**
+     * Bandwidth latency tradeoff determines how much bytes a single RTT is
+     * worth, which is a performance setting
+     */
+    uint64_t bandwidth_latency_tradeoff;
+
+    /**
+    * The factor determines the number of buckets an IBF has which is
+    * multiplied by the estimated setsize default: 2
+    */
+    uint64_t ibf_bucket_number_factor;
+
+    /**
+    * This setting determines to how many IBF buckets an single elements
+    * is mapped to.
+    */
+    uint64_t ibf_number_of_buckets_per_element;
+
 };
 
 
@@ -226,6 +251,30 @@ struct GNUNET_SETU_EvaluateMessage
    */
   uint32_t byzantine_lower_bound;
 
+  /**
+   * Upper bound for the set size, used only when
+   * byzantine mode is enabled.
+   */
+   uint64_t byzantine_upper_bond;
+
+   /**
+    * Bandwidth latency tradeoff determines how much bytes a single RTT is
+    * worth, which is a performance setting
+    */
+    uint64_t bandwidth_latency_tradeoff;
+
+    /**
+    * The factor determines the number of buckets an IBF has which is
+    * multiplied by the estimated setsize default: 2
+    */
+    uint64_t ibf_bucket_number_factor;
+
+    /**
+    * This setting determines to how many IBF buckets an single elements
+    * is mapped to.
+    */
+    uint64_t ibf_number_of_buckets_per_element;
+
   /* rest: context message, that is, application-specific
      message to convince listener to pick up */
 };
diff --git a/src/setu/setu_api.c b/src/setu/setu_api.c
index 0a09b18b2..304d3434d 100644
--- a/src/setu/setu_api.c
+++ b/src/setu/setu_api.c
@@ -526,7 +526,15 @@ GNUNET_SETU_prepare (const struct GNUNET_PeerIdentity 
*other_peer,
                                  context_msg);
   msg->app_id = *app_id;
   msg->target_peer = *other_peer;
-  for (const struct GNUNET_SETU_Option *opt = options; opt->type != 0; opt++)
+
+  /* Set default values */
+  msg->byzantine_upper_bond = UINT64_MAX;
+  msg->bandwidth_latency_tradeoff = 0;
+  msg->ibf_bucket_number_factor = 2;
+  msg->ibf_number_of_buckets_per_element = 3;
+
+
+    for (const struct GNUNET_SETU_Option *opt = options; opt->type != 0; opt++)
   {
     switch (opt->type)
     {
@@ -534,6 +542,18 @@ GNUNET_SETU_prepare (const struct GNUNET_PeerIdentity 
*other_peer,
       msg->byzantine = GNUNET_YES;
       msg->byzantine_lower_bound = htonl (opt->v.num);
       break;
+    case GNUNET_SETU_OPTION_CUSTOM_BYZANTINE_UPPER_BOUND:
+      msg->byzantine_upper_bond = htonl (opt->v.num);
+      break;
+    case GNUNET_SETU_OPTION_CUSTOM_BANDWIDTH_LATENCY_TRADEOFF:
+      msg->bandwidth_latency_tradeoff = htonl (opt->v.num);
+      break;
+    case GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKET_NUMBER_FACTOR:
+      msg->ibf_bucket_number_factor = htonl (opt->v.num);
+      break;
+     case GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKETS_PER_ELEMENT:
+      msg->ibf_number_of_buckets_per_element = htonl (opt->v.num);
+      break;
     case GNUNET_SETU_OPTION_FORCE_FULL:
       msg->force_full = GNUNET_YES;
       break;
@@ -788,6 +808,13 @@ GNUNET_SETU_accept (struct GNUNET_SETU_Request *request,
   mqm = GNUNET_MQ_msg (msg,
                        GNUNET_MESSAGE_TYPE_SETU_ACCEPT);
   msg->accept_reject_id = htonl (request->accept_id);
+
+  /* Set default values */
+  msg->byzantine_upper_bond = UINT64_MAX;
+  msg->bandwidth_latency_tradeoff = 0;
+  msg->ibf_bucket_number_factor = 2;
+  msg->ibf_number_of_buckets_per_element = 3;
+
   for (const struct GNUNET_SETU_Option *opt = options; opt->type != 0; opt++)
   {
     switch (opt->type)
@@ -796,6 +823,18 @@ GNUNET_SETU_accept (struct GNUNET_SETU_Request *request,
       msg->byzantine = GNUNET_YES;
       msg->byzantine_lower_bound = htonl (opt->v.num);
       break;
+    case GNUNET_SETU_OPTION_CUSTOM_BYZANTINE_UPPER_BOUND:
+      msg->byzantine_upper_bond = htonl (opt->v.num);
+      break;
+    case GNUNET_SETU_OPTION_CUSTOM_BANDWIDTH_LATENCY_TRADEOFF:
+      msg->bandwidth_latency_tradeoff = htonl (opt->v.num);
+      break;
+    case GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKET_NUMBER_FACTOR:
+      msg->ibf_bucket_number_factor = htonl (opt->v.num);
+      break;
+    case GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKETS_PER_ELEMENT:
+      msg->ibf_number_of_buckets_per_element = htonl (opt->v.num);
+      break;
     case GNUNET_SETU_OPTION_FORCE_FULL:
       msg->force_full = GNUNET_YES;
       break;

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