gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated (b82fedab2 -> a91090c66)


From: gnunet
Subject: [gnunet] branch master updated (b82fedab2 -> a91090c66)
Date: Tue, 31 Dec 2019 04:58:45 +0100

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

martin-schanzenbach pushed a change to branch master
in repository gnunet.

    from b82fedab2 more accurate calculation
     new 9aa5f8062 update udp communicator
     new a91090c66 add configurable rekey interval

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/transport/gnunet-communicator-tcp.c        | 15 ++++++-
 src/transport/gnunet-communicator-udp.c        | 13 ++++--
 src/transport/test_communicator_udp_peer1.conf |  1 +
 src/transport/test_communicator_udp_peer2.conf |  1 +
 src/transport/transport-testing2.c             | 60 +++++++++++++++++++++++---
 src/transport/transport_api2_communication.c   |  1 +
 6 files changed, 81 insertions(+), 10 deletions(-)

diff --git a/src/transport/gnunet-communicator-tcp.c 
b/src/transport/gnunet-communicator-tcp.c
index 63e980204..045a57d0f 100644
--- a/src/transport/gnunet-communicator-tcp.c
+++ b/src/transport/gnunet-communicator-tcp.c
@@ -68,7 +68,7 @@
 /**
  * How often do we rekey based on time (at least)
  */
-#define REKEY_TIME_INTERVAL GNUNET_TIME_UNIT_DAYS
+#define DEFAULT_REKEY_INTERVAL GNUNET_TIME_UNIT_DAYS
 
 /**
  * How long do we wait until we must have received the initial KX?
@@ -521,6 +521,11 @@ static struct GNUNET_NETWORK_Handle *listen_sock;
  */
 static struct GNUNET_PeerIdentity my_identity;
 
+/**
+ * The rekey interval
+ */
+static struct GNUNET_TIME_Relative rekey_interval;
+
 /**
  * Our private key.
  */
@@ -1246,7 +1251,7 @@ setup_out_cipher (struct Queue *queue)
   /* we don't need the private key anymore, drop it! */
   memset (&queue->ephemeral, 0, sizeof(queue->ephemeral));
   setup_cipher (&dh, &queue->target, &queue->out_cipher, &queue->out_hmac);
-  queue->rekey_time = GNUNET_TIME_relative_to_absolute (REKEY_TIME_INTERVAL);
+  queue->rekey_time = GNUNET_TIME_relative_to_absolute (rekey_interval);
   queue->rekey_left_bytes =
     GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, REKEY_MAX_BYTES);
 }
@@ -2148,6 +2153,12 @@ run (void *cls,
                                              "MAX_QUEUE_LENGTH",
                                              &max_queue_length))
     max_queue_length = DEFAULT_MAX_QUEUE_LENGTH;
+  if (GNUNET_OK !=
+      GNUNET_CONFIGURATION_get_value_time (cfg,
+                                             COMMUNICATOR_CONFIG_SECTION,
+                                             "REKEY_INTERVAL",
+                                             &rekey_interval))
+    rekey_interval = DEFAULT_REKEY_INTERVAL;
 
   in = tcp_address_to_sockaddr (bindto, &in_len);
   if (NULL == in)
diff --git a/src/transport/gnunet-communicator-udp.c 
b/src/transport/gnunet-communicator-udp.c
index 6a4fea315..5abf42588 100644
--- a/src/transport/gnunet-communicator-udp.c
+++ b/src/transport/gnunet-communicator-udp.c
@@ -1083,6 +1083,7 @@ pass_plaintext_to_core (struct SenderAddress *sender,
                         size_t plaintext_len)
 {
   const struct GNUNET_MessageHeader *hdr = plaintext;
+  const char *pos = plaintext;
 
   while (ntohs (hdr->size) < plaintext_len)
   {
@@ -1090,19 +1091,25 @@ pass_plaintext_to_core (struct SenderAddress *sender,
                               "# bytes given to core",
                               ntohs (hdr->size),
                               GNUNET_NO);
-    (void)
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Giving %u bytes to TNG\n", ntohs (hdr->size));
+    GNUNET_assert (GNUNET_SYSERR !=
     GNUNET_TRANSPORT_communicator_receive (ch,
                                            &sender->target,
                                            hdr,
                                            ADDRESS_VALIDITY_PERIOD,
                                            NULL   /* no flow control possible 
*/
                                            ,
-                                           NULL);
+                                           NULL));
     /* move on to next message, if any */
     plaintext_len -= ntohs (hdr->size);
     if (plaintext_len < sizeof(*hdr))
       break;
-    hdr = plaintext + ntohs (hdr->size);
+    pos += ntohs (hdr->size);
+    hdr = (const struct GNUNET_MessageHeader *)pos;
+    //TODO for now..., we do not actually sen >1msg or have a way of telling
+    //if we are done
+    break;
   }
   GNUNET_STATISTICS_update (stats,
                             "# bytes padding discarded",
diff --git a/src/transport/test_communicator_udp_peer1.conf 
b/src/transport/test_communicator_udp_peer1.conf
index 417e92ab5..1b35d8e8a 100644
--- a/src/transport/test_communicator_udp_peer1.conf
+++ b/src/transport/test_communicator_udp_peer1.conf
@@ -30,3 +30,4 @@ DISABLE_V6 = YES
 [communicator-udp]
 BINDTO = 60002
 DISABLE_V6 = YES
+MAX_QUEUE_LENGTH=5000
diff --git a/src/transport/test_communicator_udp_peer2.conf 
b/src/transport/test_communicator_udp_peer2.conf
index a063a545a..0472820aa 100644
--- a/src/transport/test_communicator_udp_peer2.conf
+++ b/src/transport/test_communicator_udp_peer2.conf
@@ -30,3 +30,4 @@ DISABLE_V6 = YES
 [communicator-udp]
 BINDTO = 60003
 DISABLE_V6 = YES
+MAX_QUEUE_LENGTH=5000
diff --git a/src/transport/transport-testing2.c 
b/src/transport/transport-testing2.c
index 22a767fce..41d4ab937 100644
--- a/src/transport/transport-testing2.c
+++ b/src/transport/transport-testing2.c
@@ -279,6 +279,54 @@ handle_communicator_available (
 }
 
 
+/**
+ * Incoming message.  Test message is well-formed.
+ *
+ * @param cls the client
+ * @param msg the send message that was sent
+ * @return #GNUNET_OK if message is well-formed
+ */
+static int
+check_communicator_backchannel (void *cls,
+                                const struct
+                                GNUNET_TRANSPORT_CommunicatorBackchannel *msg)
+{
+  // struct TransportClient *tc = cls;
+
+  // if (CT_COMMUNICATOR != tc->type)
+  // {
+  //  GNUNET_break (0);
+  //  return GNUNET_SYSERR;
+  // }
+  // GNUNET_MQ_check_boxed_message (msg);
+  return GNUNET_OK;
+}
+
+
+/**
+ * @brief Receive an incoming message.
+ *
+ * Pass the message to the client.
+ *
+ * @param cls Closure - communicator handle
+ * @param msg Message
+ */
+static void
+handle_communicator_backchannel (void *cls,
+                                 const struct
+                                 GNUNET_TRANSPORT_CommunicatorBackchannel *
+                                 bc_msg)
+{
+  struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls;
+  struct GNUNET_MessageHeader *msg;
+  msg = (struct GNUNET_MessageHeader *) &bc_msg[1];
+  size_t payload_len = ntohs (msg->size) - sizeof (struct
+                                                   GNUNET_MessageHeader);
+
+  GNUNET_SERVICE_client_continue (tc_h->client);
+}
+
+
 /**
  * Address of our peer added.  Test message is well-formed.
  *
@@ -373,6 +421,8 @@ handle_incoming_msg (void *cls,
   msg = (struct GNUNET_MessageHeader *) &inc_msg[1];
   size_t payload_len = ntohs (msg->size) - sizeof (struct
                                                    GNUNET_MessageHeader);
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "Incoming message from communicator!\n");
 
   if (NULL != tc_h->incoming_msg_cb)
   {
@@ -386,7 +436,7 @@ handle_incoming_msg (void *cls,
     LOG (GNUNET_ERROR_TYPE_WARNING,
          "Incoming message from communicator but no handler!\n");
   }
-  if (0 != ntohl (inc_msg->fc_on))
+  if (GNUNET_YES == ntohl (inc_msg->fc_on))
   {
     /* send ACK when done to communicator for flow control! */
     struct GNUNET_MQ_Envelope *env;
@@ -613,10 +663,10 @@ transport_communicator_start (
                            GNUNET_MESSAGE_TYPE_TRANSPORT_NEW_COMMUNICATOR,
                            struct 
GNUNET_TRANSPORT_CommunicatorAvailableMessage,
                            tc_h),
-    // GNUNET_MQ_hd_var_size (communicator_backchannel,
-    //    GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL,
-    //    struct GNUNET_TRANSPORT_CommunicatorBackchannel,
-    //    NULL),
+    GNUNET_MQ_hd_var_size (communicator_backchannel,
+                           
GNUNET_MESSAGE_TYPE_TRANSPORT_COMMUNICATOR_BACKCHANNEL,
+                           struct GNUNET_TRANSPORT_CommunicatorBackchannel,
+                           tc_h),
     GNUNET_MQ_hd_var_size (add_address,
                            GNUNET_MESSAGE_TYPE_TRANSPORT_ADD_ADDRESS,
                            struct GNUNET_TRANSPORT_AddAddressMessage,
diff --git a/src/transport/transport_api2_communication.c 
b/src/transport/transport_api2_communication.c
index 9df9424da..01a2447fa 100644
--- a/src/transport/transport_api2_communication.c
+++ b/src/transport/transport_api2_communication.c
@@ -893,6 +893,7 @@ GNUNET_TRANSPORT_communicator_receive (
   // and then have the application fill in the body so we do
   // not have to memcpy()
   memcpy (&im[1], msg, msize);
+  im->fc_on = htonl (GNUNET_NO);
   if (NULL != cb)
   {
     struct FlowControl *fc;

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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