gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] 22/164: Added some more granuar facor increase


From: gnunet
Subject: [gnunet] 22/164: Added some more granuar facor increase
Date: Fri, 30 Jul 2021 15:31:28 +0200

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

grothoff pushed a commit to branch master
in repository gnunet.

commit 4d696467a75b073a7dfd8d64c91e01590d3e4ec7
Author: Elias Summermatter <elias.summermatter@seccom.ch>
AuthorDate: Sun Apr 11 15:10:42 2021 +0200

    Added some more granuar facor increase
---
 src/set/ibf.c                           |  2 +-
 src/setu/gnunet-service-setu.c          | 51 ++++++++++++++++-----------------
 src/setu/gnunet-service-setu_protocol.h | 15 ++--------
 src/setu/perf_setu_api.c                |  2 +-
 4 files changed, 28 insertions(+), 42 deletions(-)

diff --git a/src/set/ibf.c b/src/set/ibf.c
index 1532afceb..0f7eb6a9f 100644
--- a/src/set/ibf.c
+++ b/src/set/ibf.c
@@ -294,7 +294,7 @@ ibf_write_slice (const struct InvertibleBloomFilter *ibf, 
uint32_t start,
   struct IBF_KeyHash *key_hash_dst;
   struct IBF_Count *count_dst;
 
-  GNUNET_assert (start + count <= ibf->size);
+    GNUNET_assert (start + count <= ibf->size);
 
   /* copy keys */
   key_dst = (struct IBF_Key *) buf;
diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c
index 8fb1f782d..9750ba0e5 100644
--- a/src/setu/gnunet-service-setu.c
+++ b/src/setu/gnunet-service-setu.c
@@ -1371,13 +1371,13 @@ prepare_ibf (struct Operation *op,
  */
 static int
 send_ibf (struct Operation *op,
-          uint16_t ibf_order)
+          uint32_t ibf_size)
 {
   unsigned int buckets_sent = 0;
   struct InvertibleBloomFilter *ibf;
 
   if (GNUNET_OK !=
-      prepare_ibf (op, 1 << ibf_order))
+      prepare_ibf (op, ibf_size))
   {
     /* allocation failed */
     return GNUNET_SYSERR;
@@ -1385,23 +1385,23 @@ send_ibf (struct Operation *op,
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "sending ibf of size %u\n",
-       1 << ibf_order);
+       1 << ibf_size);
 
   {
     char name[64];
-    GNUNET_snprintf (name, sizeof(name), "# sent IBF (order %u)", ibf_order);
+    GNUNET_snprintf (name, sizeof(name), "# sent IBF (order %u)", ibf_size);
     GNUNET_STATISTICS_update (_GSS_statistics, name, 1, GNUNET_NO);
   }
 
   ibf = op->local_ibf;
 
-  while (buckets_sent < (1 << ibf_order))
+  while (buckets_sent < ibf_size)
   {
     unsigned int buckets_in_message;
     struct GNUNET_MQ_Envelope *ev;
     struct IBFMessage *msg;
 
-    buckets_in_message = (1 << ibf_order) - buckets_sent;
+    buckets_in_message = ibf_size - buckets_sent;
     /* limit to maximum */
     if (buckets_in_message > MAX_BUCKETS_PER_MESSAGE)
       buckets_in_message = MAX_BUCKETS_PER_MESSAGE;
@@ -1411,9 +1411,7 @@ send_ibf (struct Operation *op,
     ev = GNUNET_MQ_msg_extra (msg,
                               buckets_in_message * IBF_BUCKET_SIZE,
                               GNUNET_MESSAGE_TYPE_SETU_P2P_IBF);
-    msg->reserved1 = 0;
-    msg->reserved2 = 0;
-    msg->order = ibf_order;
+    msg->ibf_size = ibf_size;
     msg->offset = htonl (buckets_sent);
     msg->salt = htonl (op->salt_send);
     ibf_write_slice (ibf, buckets_sent,
@@ -1423,12 +1421,12 @@ send_ibf (struct Operation *op,
          "ibf chunk size %u, %u/%u sent\n",
          buckets_in_message,
          buckets_sent,
-         1 << ibf_order);
+         ibf_size);
     GNUNET_MQ_send (op->mq, ev);
   }
 
-  /* The other peer must decode the IBF, so
-   * we're passive. */
+    /* The other peer must decode the IBF, so
+     * we're passive. */
   op->phase = PHASE_PASSIVE_DECODING;
   return GNUNET_OK;
 }
@@ -1442,10 +1440,11 @@ send_ibf (struct Operation *op,
  * @return the required size of the ibf
  */
 static unsigned int
-get_order_from_difference (unsigned int diff, int number_buckets_per_element, 
float ibf_bucket_number_factor)
+get_size_from_difference (unsigned int diff, int number_buckets_per_element, 
float ibf_bucket_number_factor)
 {
-  unsigned int ibf_order;
+  return diff * ibf_bucket_number_factor;
 
+  unsigned int ibf_order;
   ibf_order = 2;
   while (((1 << ibf_order) < (ibf_bucket_number_factor * diff) ||
           ((1 << ibf_order) < number_buckets_per_element)) &&
@@ -1616,7 +1615,7 @@ handle_union_p2p_strata_estimator (void *cls,
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "got se diff=%d, using ibf size %d\n",
        diff,
-       1U << get_order_from_difference (diff, 
op->ibf_number_buckets_per_element, op->ibf_bucket_number_factor));
+       1U << get_size_from_difference (diff, 
op->ibf_number_buckets_per_element, op->ibf_bucket_number_factor));
 
   {
     char *set_debug;
@@ -1682,7 +1681,7 @@ handle_union_p2p_strata_estimator (void *cls,
                               GNUNET_NO);
     if (GNUNET_OK !=
         send_ibf (op,
-                  get_order_from_difference (diff, 
op->ibf_number_buckets_per_element, op->ibf_bucket_number_factor)))
+                  get_size_from_difference (diff, 
op->ibf_number_buckets_per_element, op->ibf_bucket_number_factor)))
     {
       /* Internal error, best we can do is shut the connection */
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -1828,17 +1827,14 @@ decode_and_send (struct Operation *op)
     if ((GNUNET_SYSERR == res) ||
         (GNUNET_YES == cycle_detected))
     {
-      int next_order;
-      next_order = 0;
-      while (1 << next_order < diff_ibf->size)
-        next_order++;
-      next_order++;
+      uint32_t next_size;
+      next_size = diff_ibf->size * 2;
 
-      if (next_order <= MAX_IBF_ORDER)
+      if (next_size > diff_ibf->size) /** FIXME: ADD HERA A MAX LIMIT! if 
(next_order <= MAX_IBF_ORDER) **/
       {
         LOG (GNUNET_ERROR_TYPE_ERROR,
              "decoding failed, sending larger ibf (size %u)\n",
-             1 << next_order);
+             next_size);
         GNUNET_STATISTICS_update (_GSS_statistics,
                                   "# of IBF retries",
                                   1,
@@ -1848,7 +1844,7 @@ decode_and_send (struct Operation *op)
           op->salt_send += 1;
 
         if (GNUNET_OK !=
-            send_ibf (op, next_order))
+            send_ibf (op, next_size))
         {
           /* Internal error, best we can do is shut the connection */
           GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -1966,7 +1962,8 @@ check_union_p2p_ibf (void *cls,
       GNUNET_break_op (0);
       return GNUNET_SYSERR;
     }
-    if (1 << msg->order != op->remote_ibf->size)
+
+    if (msg->ibf_size != op->remote_ibf->size)
     {
       GNUNET_break_op (0);
       return GNUNET_SYSERR;
@@ -2016,9 +2013,9 @@ handle_union_p2p_ibf (void *cls,
     GNUNET_assert (NULL == op->remote_ibf);
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "Creating new ibf of size %u\n",
-         1 << msg->order);
+         ntohl (msg->ibf_size));
     // op->remote_ibf = ibf_create (1 << msg->order, SE_IBF_HASH_NUM);
-    op->remote_ibf = ibf_create (1 << msg->order, ((uint8_t) 
op->ibf_number_buckets_per_element));
+    op->remote_ibf = ibf_create (msg->ibf_size, ((uint8_t) 
op->ibf_number_buckets_per_element));
     op->salt_receive = ntohl (msg->salt);
     LOG (GNUNET_ERROR_TYPE_DEBUG,
          "Receiving new IBF with salt %u\n",
diff --git a/src/setu/gnunet-service-setu_protocol.h 
b/src/setu/gnunet-service-setu_protocol.h
index a2803ee47..97065441d 100644
--- a/src/setu/gnunet-service-setu_protocol.h
+++ b/src/setu/gnunet-service-setu_protocol.h
@@ -72,20 +72,9 @@ struct IBFMessage
   struct GNUNET_MessageHeader header;
 
   /**
-   * Order of the whole ibf, where
-   * num_buckets = 2^order
+   * Size of the whole ibf (number of buckets)
    */
-  uint8_t order;
-
-  /**
-   * Padding, must be 0.
-   */
-  uint8_t reserved1;
-
-  /**
-   * Padding, must be 0.
-   */
-  uint16_t reserved2 GNUNET_PACKED;
+  uint32_t ibf_size;
 
   /**
    * Offset of the strata in the rest of the message
diff --git a/src/setu/perf_setu_api.c b/src/setu/perf_setu_api.c
index 31b0e2923..32292af2b 100644
--- a/src/setu/perf_setu_api.c
+++ b/src/setu/perf_setu_api.c
@@ -449,7 +449,7 @@ static void execute_perf() {
 
     for (int out_out_ctr = 1; out_out_ctr <= 10; out_out_ctr++) {
 
-        for (int out_ctr = 10; out_ctr <= 60; out_ctr++) {
+        for (int out_ctr = 1; out_ctr <= 100; out_ctr++) {
 
             float base = 0.1;
             float x = out_ctr * base;

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