gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated (a8bd85390 -> 99d3589e5)


From: gnunet
Subject: [gnunet] branch master updated (a8bd85390 -> 99d3589e5)
Date: Tue, 24 Dec 2019 14:47:41 +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 a8bd85390 more minor fixes and better measurements
     new a967815bd fix dropped pkts; wip
     new 5c5a31d18 start nat for tcp
     new 99d3589e5 update configs

The 3 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-unix.c        | 50 ++++++++++++-------
 src/transport/test_communicator_basic.c         | 51 ++++++++++++-------
 src/transport/test_communicator_unix_peer1.conf |  4 ++
 src/transport/test_communicator_unix_peer2.conf |  3 ++
 src/transport/transport-testing2.c              | 65 +++++++++++++++++++++++--
 5 files changed, 134 insertions(+), 39 deletions(-)

diff --git a/src/transport/gnunet-communicator-unix.c 
b/src/transport/gnunet-communicator-unix.c
index 29ec087e1..5d7949b97 100644
--- a/src/transport/gnunet-communicator-unix.c
+++ b/src/transport/gnunet-communicator-unix.c
@@ -42,7 +42,7 @@
  * otherwise we may read messages just to have them dropped
  * by the communicator API.
  */
-#define DEFAULT_MAX_QUEUE_LENGTH 8
+#define DEFAULT_MAX_QUEUE_LENGTH 8000
 
 /**
  * Address prefix used by the communicator.
@@ -412,16 +412,6 @@ select_write_cb (void *cls)
 
   /* take queue of the ready list */
   write_task = NULL;
-  GNUNET_CONTAINER_DLL_remove (queue_head, queue_tail, queue);
-  if (NULL != queue_head)
-    write_task = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL,
-                                                 unix_sock,
-                                                 &select_write_cb,
-                                                 NULL);
-
-  /* send 'msg' */
-  queue->msg = NULL;
-  GNUNET_MQ_impl_send_continue (queue->mq);
 resend:
   /* Send the data */
   sent = GNUNET_NETWORK_socket_sendto (unix_sock,
@@ -437,6 +427,17 @@ resend:
               (sent < 0) ? strerror (errno) : "ok");
   if (-1 != sent)
   {
+    GNUNET_CONTAINER_DLL_remove (queue_head, queue_tail, queue);
+    if (NULL != queue_head)
+      write_task = GNUNET_SCHEDULER_add_write_net 
(GNUNET_TIME_UNIT_FOREVER_REL,
+                                                   unix_sock,
+                                                   &select_write_cb,
+                                                   NULL);
+
+    /* send 'msg' */
+    GNUNET_free (queue->msg);
+    queue->msg = NULL;
+    GNUNET_MQ_impl_send_continue (queue->mq);
     GNUNET_STATISTICS_update (stats,
                               "# bytes sent",
                               (long long) sent,
@@ -448,6 +449,10 @@ resend:
                             "# network transmission failures",
                             1,
                             GNUNET_NO);
+  write_task = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL,
+                                               unix_sock,
+                                               &select_write_cb,
+                                               NULL);
   switch (errno)
   {
   case EAGAIN:
@@ -473,7 +478,7 @@ resend:
         return;
       }
       GNUNET_log (
-        GNUNET_ERROR_TYPE_DEBUG,
+        GNUNET_ERROR_TYPE_WARNING,
         "Trying to increase socket buffer size from %u to %u for message size 
%u\n",
         (unsigned int) size,
         (unsigned int) ((msg_size / 1000) + 2) * 1000,
@@ -523,9 +528,9 @@ mq_send (struct GNUNET_MQ_Handle *mq,
 
   GNUNET_assert (mq == queue->mq);
   GNUNET_assert (NULL == queue->msg);
-  //Convert to UNIXMessage
+  // Convert to UNIXMessage
   queue->msg = GNUNET_malloc (msize + sizeof (struct UNIXMessage));
-  queue->msg->header.size = htons(msize + sizeof (struct UNIXMessage));
+  queue->msg->header.size = htons (msize + sizeof (struct UNIXMessage));
   queue->msg->sender = my_identity;
   memcpy (&queue->msg[1], msg, msize);
   GNUNET_CONTAINER_DLL_insert (queue_head, queue_tail, queue);
@@ -697,14 +702,13 @@ receive_complete_cb (void *cls, int success)
 {
   (void) cls;
   delivering_messages--;
-
   if (GNUNET_OK != success)
     GNUNET_STATISTICS_update (stats,
                               "# transport transmission failures",
                               1,
                               GNUNET_NO);
-  GNUNET_assert (NULL != unix_sock);
-  if ((NULL == read_task) && (delivering_messages < max_queue_length))
+  if ((NULL == read_task) && (delivering_messages < max_queue_length) &&
+      (NULL != unix_sock))
     read_task = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
                                                unix_sock,
                                                &select_read_cb,
@@ -807,15 +811,26 @@ select_read_cb (void *cls)
                                                    &receive_complete_cb,
                                                    NULL);
       if (GNUNET_SYSERR == ret)
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                    "Transport not up!\n");
         return;   /* transport not up */
+      }
       if (GNUNET_NO == ret)
+      {
+        GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                    "Error sending message to transport\n");
         break;
+      }
       delivering_messages++;
       offset += csize;
     }
   }
   if (delivering_messages >= max_queue_length)
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Back pressure %llu\n", delivering_messages);
+
     /* we should try to apply 'back pressure' */
     GNUNET_SCHEDULER_cancel (read_task);
     read_task = NULL;
@@ -991,6 +1006,7 @@ run (void *cls,
   struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key;
 
   (void) cls;
+  delivering_messages = 0;
 
   my_private_key = GNUNET_CRYPTO_eddsa_key_create_from_configuration (cfg);
   if (NULL == my_private_key)
diff --git a/src/transport/test_communicator_basic.c 
b/src/transport/test_communicator_basic.c
index d7622a2cc..ef91e133d 100644
--- a/src/transport/test_communicator_basic.c
+++ b/src/transport/test_communicator_basic.c
@@ -69,7 +69,7 @@ static struct 
GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *my_tc;
 #define BURST_RUNS 1
 
 #define SHORT_BURST_WINDOW \
-  GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,5)
+  GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,2)
 
 #define LONG_BURST_WINDOW \
   GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,2)
@@ -81,7 +81,7 @@ static struct 
GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *my_tc;
 #define SIZE_CHECK 2
 
 
-static int num_sent = 0;
+static size_t num_sent = 0;
 
 static uint32_t ack = 0;
 
@@ -91,6 +91,8 @@ static size_t num_received = 0;
 
 static uint64_t avg_latency = 0;
 
+static struct GNUNET_TIME_Relative duration;
+
 static void
 communicator_available_cb (void *cls,
                            struct
@@ -187,18 +189,20 @@ size_test (void *cls)
                                                           ack);
     GNUNET_free (payload);
     ack += 5;
+    num_sent++;
     if (ack < 64000)
       GNUNET_SCHEDULER_add_now (&size_test, NULL);
     else
-      GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
+      GNUNET_SCHEDULER_add_delayed (SHORT_BURST_WINDOW,
                                     &size_test, NULL);
     return;
   }
   GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
               "Size packet test done.\n");
   GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
-              "#packets: %lu -- latency: %lu microseconds\n",
+              "%lu/%lu packets -- avg latency: %lu us\n",
               num_received,
+              num_sent,
               avg_latency);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Finished\n");
@@ -210,8 +214,6 @@ size_test (void *cls)
 static void
 long_test (void *cls)
 {
-  struct GNUNET_TIME_Relative duration = GNUNET_TIME_absolute_get_duration (
-    start_long);
   char *payload;
   if (num_sent < BURST_PACKETS)
   {
@@ -228,13 +230,14 @@ long_test (void *cls)
                                     &long_test, NULL);
     return;
   }
-  duration = GNUNET_TIME_absolute_get_duration (start_long);
   GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
               "Long size packet test done.\n");
   GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
-              "goodput: %lu kb/s -- #packets: %lu -- latency: %lu 
microseconds\n",
-              (LONG_MESSAGE_SIZE * num_received) / (duration.rel_value_us / 
1000),
+              "%lu/%lu packets in %lu us (%lu kb/s) -- avg latency: %lu us\n",
               num_received,
+              num_sent,
+              duration.rel_value_us,
+              (LONG_MESSAGE_SIZE * num_received) / (duration.rel_value_us / 
1000),
               avg_latency);
   ack = 10;
   num_received = 0;
@@ -247,9 +250,8 @@ long_test (void *cls)
 static void
 short_test (void *cls)
 {
-  struct GNUNET_TIME_Relative duration;
   char *payload;
-  if (num_sent < BURST_PACKETS)
+  while (num_sent < BURST_PACKETS)
   {
     payload = make_payload (SHORT_MESSAGE_SIZE);
     GNUNET_TRANSPORT_TESTING_transport_communicator_send (my_tc,
@@ -257,20 +259,23 @@ short_test (void *cls)
                                                           SHORT_MESSAGE_SIZE);
     num_sent++;
     GNUNET_free (payload);
-    if (num_sent < BURST_PACKETS)
-      GNUNET_SCHEDULER_add_now (&short_test, NULL);
+    //if (num_sent < BURST_PACKETS)
+    //  GNUNET_SCHEDULER_add_now (&short_test, NULL);
     if (num_sent == BURST_PACKETS)
+    {
       GNUNET_SCHEDULER_add_delayed (SHORT_BURST_WINDOW,
                                     &short_test, NULL);
-    return;
+      return;
+    }
   }
-  duration = GNUNET_TIME_absolute_get_duration (start_short);
   GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
               "Short size packet test done.\n");
   GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
-              "goodput: %lu kb/s -- #packets: %lu -- latency: %lu 
microseconds\n",
-              (SHORT_MESSAGE_SIZE * num_received) / (duration.rel_value_us / 
1000),
+              "%lu/%lu packets in %lu us (%lu kb/s) -- avg latency: %lu us\n",
               num_received,
+              num_sent,
+              duration.rel_value_us,
+              (SHORT_MESSAGE_SIZE * num_received) / (duration.rel_value_us / 
1000),
               avg_latency);
   start_long = GNUNET_TIME_absolute_get ();
   phase = BURST_LONG;
@@ -345,18 +350,28 @@ incoming_message_cb (void *cls,
                      size_t payload_len)
 {
   if (0 != strcmp ((char*) cls, cfg_peers_name[NUM_PEERS - 1]))
-    return; // TODO?
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "unexpected receiver...\n");
+    return;
+  }
   if (phase == BURST_SHORT)
   {
     GNUNET_assert (SHORT_MESSAGE_SIZE == payload_len);
     num_received++;
+    duration = GNUNET_TIME_absolute_get_duration (start_short);
     update_avg_latency (payload);
   }
   else if (phase == BURST_LONG)
   {
     if (LONG_MESSAGE_SIZE != payload_len)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                  "Ignoring packet with wrong length\n");
       return; // Ignore
+    }
     num_received++;
+    duration = GNUNET_TIME_absolute_get_duration (start_long);
     update_avg_latency (payload);
   }
   else         // if (phase == SIZE_CHECK) {
diff --git a/src/transport/test_communicator_unix_peer1.conf 
b/src/transport/test_communicator_unix_peer1.conf
index f0d5ac299..411b7f587 100644
--- a/src/transport/test_communicator_unix_peer1.conf
+++ b/src/transport/test_communicator_unix_peer1.conf
@@ -16,6 +16,10 @@ PORT = 52401
 PORT = 60000
 UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-transport_test_1.sock
 
+[nat]
+UNIXPATH = $GNUNET_TMP/test-communicator-unix-1/nat.sock
+ENABLE_IPSCAN = YES
+
 [communicator-unix]
 UNIXPATH = $GNUNET_RUNTIME_DIR/test_gnunet-communicator-unix_1.sock
 
diff --git a/src/transport/test_communicator_unix_peer2.conf 
b/src/transport/test_communicator_unix_peer2.conf
index 1897f4039..d06ef0d1e 100644
--- a/src/transport/test_communicator_unix_peer2.conf
+++ b/src/transport/test_communicator_unix_peer2.conf
@@ -17,6 +17,9 @@ PORT = 52401
 PORT = 60001
 UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-transport_test_2.sock
 
+[nat]
+UNIXPATH = $GNUNET_TMP/test-communicator-unix-2/nat.sock
+
 [communicator-unix]
 UNIXPATH = $GNUNET_RUNTIME_DIR/test_gnunet-communicator-unix_2.sock
 
diff --git a/src/transport/transport-testing2.c 
b/src/transport/transport-testing2.c
index ba58776fb..558bf007f 100644
--- a/src/transport/transport-testing2.c
+++ b/src/transport/transport-testing2.c
@@ -79,6 +79,11 @@ struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle
    */
   struct GNUNET_OS_Process *c_proc;
 
+  /**
+   * NAT process
+   */
+  struct GNUNET_OS_Process *nat_proc;
+
   /**
    * @brief Task that will be run on shutdown to stop and clean communicator
    */
@@ -660,10 +665,8 @@ transport_communicator_start (
  * @param cls Closure - Process of communicator
  */
 static void
-shutdown_communicator (void *cls)
+shutdown_process (struct GNUNET_OS_Process *proc)
 {
-  struct GNUNET_OS_Process *proc = cls;
-
   if (0 != GNUNET_OS_process_kill (proc, SIGTERM))
   {
     LOG (GNUNET_ERROR_TYPE_WARNING,
@@ -677,6 +680,13 @@ shutdown_communicator (void *cls)
   GNUNET_OS_process_destroy (proc);
 }
 
+static void
+shutdown_communicator (void *cls)
+{
+  struct GNUNET_OS_Process *proc = cls;
+  shutdown_process(proc);
+}
+
 
 /**
  * @brief Start the communicator
@@ -711,6 +721,51 @@ communicator_start (
   GNUNET_free (binary);
 }
 
+/**
+ * @brief Task run at shutdown to kill communicator and clean up
+ *
+ * @param cls Closure - Process of communicator
+ */
+static void
+shutdown_nat (void *cls)
+{
+  struct GNUNET_OS_Process *proc = cls;
+  shutdown_process (proc);
+}
+
+
+/**
+ * @brief Start NAT
+ *
+ */
+static void
+nat_start (
+  struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h)
+{
+  char *binary;
+
+  LOG (GNUNET_ERROR_TYPE_DEBUG, "nat_start\n");
+  binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-nat");
+  tc_h->nat_proc = GNUNET_OS_start_process (GNUNET_YES,
+                                          GNUNET_OS_INHERIT_STD_OUT_AND_ERR,
+                                          NULL,
+                                          NULL,
+                                          NULL,
+                                          binary,
+                                          "gnunet-service-nat",
+                                          "-c",
+                                          tc_h->cfg_filename,
+                                          NULL);
+  if (NULL == tc_h->nat_proc)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to start NAT!");
+    return;
+  }
+  LOG (GNUNET_ERROR_TYPE_INFO, "started NAT\n");
+  GNUNET_free (binary);
+}
+
+
 
 static void
 do_shutdown (void *cls)
@@ -718,6 +773,7 @@ do_shutdown (void *cls)
   struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h = cls;
   shutdown_communicator(tc_h->c_proc);
   shutdown_service(tc_h->sh);
+  shutdown_nat(tc_h->nat_proc);
 }
 
 
@@ -771,7 +827,8 @@ 
GNUNET_TRANSPORT_TESTING_transport_communicator_service_start (
 
   /* Start communicator part of service */
   transport_communicator_start (tc_h);
-
+  /* Start NAT */
+  nat_start (tc_h);
   /* Schedule start communicator */
   communicator_start (tc_h,
                       binary_name);

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



reply via email to

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