gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] 104/164: Added full send commit message + changes request full


From: gnunet
Subject: [gnunet] 104/164: Added full send commit message + changes request full message
Date: Fri, 30 Jul 2021 15:32:50 +0200

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

grothoff pushed a commit to branch master
in repository gnunet.

commit 9c081f6bc64c86f2d29eb4dc1825378393d67556
Author: Elias Summermatter <elias.summermatter@seccom.ch>
AuthorDate: Sat May 22 14:39:04 2021 +0200

    Added full send commit message + changes request full message
---
 src/include/gnunet_protocols.h          |  7 +++
 src/setu/gnunet-service-setu.c          | 88 ++++++++++++++++++++++++++-------
 src/setu/gnunet-service-setu_protocol.h | 26 ++++++++++
 3 files changed, 102 insertions(+), 19 deletions(-)

diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 715e94c6a..6b61dfc72 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -1784,6 +1784,13 @@ extern "C" {
  */
 #define GNUNET_MESSAGE_TYPE_SETU_P2P_OVER 572
 
+/**
+ * Signals other peer that all elements are sent.
+ */
+
+#define GNUNET_MESSAGE_TYPE_SETU_P2P_SEND_FULL 710
+
+
 
 
/*******************************************************************************
  * SETI message types
diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c
index dc00cf96c..6039d963b 100644
--- a/src/setu/gnunet-service-setu.c
+++ b/src/setu/gnunet-service-setu.c
@@ -500,9 +500,14 @@ struct Operation
     uint64_t upper_element_boundary;
 
     /**
-     * is
+     * is the count of already pased differential sync iterations
      */
      uint8_t differential_sync_iterations;
+
+    /**
+     * Estimated or committed set difference at the start
+    */
+    uint64_t set_diff;
 };
 
 
@@ -2057,10 +2062,6 @@ handle_union_p2p_strata_estimator (void *cls,
     return;
   }
 
-
-  /**
-   * Added rtt_bandwidth_tradeoff directly need future improvements
-   */
   if ((GNUNET_YES == op->force_full) ||
       ( op->mode_of_operation != DIFFERENTIAL_SYNC) ||
       (0 == other_size))
@@ -2076,6 +2077,13 @@ handle_union_p2p_strata_estimator (void *cls,
     if ((op->mode_of_operation == FULL_SYNC_LOCAL_SENDING_FIRST) ||
         (0 == other_size))
     {
+      struct TransmitFullMessage *signal_msg;
+      struct GNUNET_MQ_Envelope *ev;
+      ev = GNUNET_MQ_msg_extra(signal_msg,sizeof(struct 
TransmitFullMessage),GNUNET_MESSAGE_TYPE_SETU_P2P_SEND_FULL);
+      signal_msg->set_difference = htonl(diff_remote + diff_local);
+      signal_msg->set_size = htonl(op->number_elements_local);
+      GNUNET_MQ_send (op->mq,
+                        ev);
       send_full_set (op);
     }
     else
@@ -2086,10 +2094,12 @@ handle_union_p2p_strata_estimator (void *cls,
            "Telling other peer that we expect its full set\n");
       op->phase = PHASE_FULL_RECEIVING;
       perf_rtt.request_full.sent += 1;
-      ev = GNUNET_MQ_msg_header (
-        GNUNET_MESSAGE_TYPE_SETU_P2P_REQUEST_FULL);
+      struct TransmitFullMessage *signal_msg;
+      ev = GNUNET_MQ_msg_extra(signal_msg,sizeof(struct 
TransmitFullMessage),GNUNET_MESSAGE_TYPE_SETU_P2P_REQUEST_FULL);
+      signal_msg->set_difference = htonl(diff_remote + diff_local);
+      signal_msg->set_size = htonl(op->number_elements_local);
       GNUNET_MQ_send (op->mq,
-                      ev);
+                        ev);
     }
   }
   else
@@ -2413,6 +2423,36 @@ decode_and_send (struct Operation *op)
 }
 
 
+static int
+check_union_p2p_send_full (void *cls,
+                            const struct TransmitFullMessage *msg)
+{
+    return GNUNET_OK;
+}
+
+static void
+handle_union_p2p_send_full (void *cls,
+                      const struct TransmitFullMessage *msg)
+{
+    struct Operation *op = cls;
+
+    /**
+    * Check that the message is received only in supported phase
+    */
+    uint8_t allowed_phases[] = {PHASE_EXPECT_IBF};
+    if( GNUNET_OK !=
+        check_valid_phase(allowed_phases,sizeof(allowed_phases),op)){
+        GNUNET_break (0);
+        fail_union_operation (op);
+        return;
+    }
+
+    op->remote_element_count = ntohl(msg->set_size);
+    op->set_diff = ntohl(msg->set_size);
+    op->phase = PHASE_FULL_RECEIVING;
+}
+
+
 /**
  * Check an IBF message from a remote peer.
  *
@@ -2500,10 +2540,6 @@ handle_union_p2p_ibf (void *cls,
         return;
     }
   op->differential_sync_iterations++;
-    LOG (GNUNET_ERROR_TYPE_ERROR,
-         "XXXXXXXXXXXXXXXXXX %u\n", op->differential_sync_iterations);
-
-
 
   perf_rtt.ibf.received += 1;
   perf_rtt.ibf.received_var_bytes += (ntohs (msg->header.size) - sizeof *msg);
@@ -2842,10 +2878,6 @@ handle_union_p2p_full_element (void *cls,
   struct KeyEntry *ke;
   uint16_t element_size;
 
-  if(PHASE_EXPECT_IBF == op->phase) {
-      op->phase = PHASE_FULL_RECEIVING;
-  }
-
   /**
   * Check that the message is received only in supported phase
   */
@@ -3066,9 +3098,16 @@ send_missing_full_elements_iter (void *cls,
  * @param cls closure, a set union operation
  * @param mh the demand message
  */
+static int
+check_union_p2p_request_full (void *cls,
+                               const struct GNUNET_MessageHeader *mh)
+{
+    return GNUNET_OK;
+}
+
 static void
 handle_union_p2p_request_full (void *cls,
-                               const struct GNUNET_MessageHeader *mh)
+                               const struct TransmitFullMessage *msg)
 {
   struct Operation *op = cls;
 
@@ -3083,6 +3122,9 @@ handle_union_p2p_request_full (void *cls,
      return;
   }
 
+    op->remote_element_count = ntohl(msg->set_size);
+    op->set_diff = ntohl(msg->set_size);
+
   perf_rtt.request_full.received += 1;
 
     LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -4019,7 +4061,7 @@ handle_client_listen (void *cls,
                              GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_DONE,
                              struct GNUNET_MessageHeader,
                              NULL),
-    GNUNET_MQ_hd_fixed_size (union_p2p_request_full,
+    GNUNET_MQ_hd_var_size (union_p2p_request_full,
                              GNUNET_MESSAGE_TYPE_SETU_P2P_REQUEST_FULL,
                              struct GNUNET_MessageHeader,
                              NULL),
@@ -4035,6 +4077,10 @@ handle_client_listen (void *cls,
                            GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_ELEMENT,
                            struct GNUNET_SETU_ElementMessage,
                            NULL),
+    GNUNET_MQ_hd_var_size (union_p2p_send_full,
+                           GNUNET_MESSAGE_TYPE_SETU_P2P_SEND_FULL,
+                           struct TransmitFullMessage,
+                           NULL),
     GNUNET_MQ_handler_end ()
   };
   struct Listener *listener;
@@ -4268,7 +4314,7 @@ handle_client_evaluate (void *cls,
                              GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_DONE,
                              struct GNUNET_MessageHeader,
                              op),
-    GNUNET_MQ_hd_fixed_size (union_p2p_request_full,
+    GNUNET_MQ_hd_var_size (union_p2p_request_full,
                              GNUNET_MESSAGE_TYPE_SETU_P2P_REQUEST_FULL,
                              struct GNUNET_MessageHeader,
                              op),
@@ -4284,6 +4330,10 @@ handle_client_evaluate (void *cls,
                            GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_ELEMENT,
                            struct GNUNET_SETU_ElementMessage,
                            op),
+    GNUNET_MQ_hd_var_size (union_p2p_send_full,
+                           GNUNET_MESSAGE_TYPE_SETU_P2P_SEND_FULL,
+                           struct TransmitFullMessage,
+                           NULL),
     GNUNET_MQ_handler_end ()
   };
   struct Set *set;
diff --git a/src/setu/gnunet-service-setu_protocol.h 
b/src/setu/gnunet-service-setu_protocol.h
index 418fa7c7e..64a99bb1b 100644
--- a/src/setu/gnunet-service-setu_protocol.h
+++ b/src/setu/gnunet-service-setu_protocol.h
@@ -215,6 +215,32 @@ struct StrataEstimatorMessage
   uint64_t set_size;
 };
 
+
+/**
+ * Message which signals to other peer that we are sending full set
+ *
+ */
+struct TransmitFullMessage
+{
+    /**
+     * Type: #GNUNET_MESSAGE_TYPE_SETU_P2P_SEND_FULL
+     */
+    struct GNUNET_MessageHeader header;
+
+    /**
+     * Set difference Calculated with strata estimator
+     */
+    uint32_t set_difference;
+
+    /**
+     * Local set size
+     */
+    uint32_t set_size;
+
+
+};
+
+
 GNUNET_NETWORK_STRUCT_END
 
 #endif

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