gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated (7398be32b -> d1dea55be)


From: gnunet
Subject: [gnunet] branch master updated (7398be32b -> d1dea55be)
Date: Wed, 25 Dec 2019 15:53:47 +0100

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

grothoff pushed a change to branch master
in repository gnunet.

    from 7398be32b fix kx
     new 362288ecb avoid constantly adding/removing timeout task
     new bcf193771 Merge branch 'master' of git+ssh://gnunet.org/gnunet
     new d1dea55be more iters

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/test_communicator_basic.c | 60 +++++++++++++--------------------
 1 file changed, 23 insertions(+), 37 deletions(-)

diff --git a/src/transport/test_communicator_basic.c 
b/src/transport/test_communicator_basic.c
index 5d69b21b3..e9b982897 100644
--- a/src/transport/test_communicator_basic.c
+++ b/src/transport/test_communicator_basic.c
@@ -64,6 +64,8 @@ static struct GNUNET_TIME_Absolute start_short;
 
 static struct GNUNET_TIME_Absolute start_long;
 
+static struct GNUNET_TIME_Absolute timeout;
+
 static struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *my_tc;
 
 #define SHORT_MESSAGE_SIZE 128
@@ -74,7 +76,7 @@ static struct 
GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *my_tc;
 
 #define FIXME_DEAD_BURST_RUNS 1
 
-#define TOTAL_ITERATIONS 10
+#define TOTAL_ITERATIONS 20
 
 static unsigned int iterations_left = TOTAL_ITERATIONS;
 
@@ -196,9 +198,18 @@ static void
 latency_timeout (void *cls)
 {
   to_task = NULL;
+  if (GNUNET_TIME_absolute_get_remaining (timeout).rel_value_us > 0)
+  {
+    to_task = GNUNET_SCHEDULER_add_at (timeout,
+                                       &latency_timeout,
+                                       NULL);
+    return;
+  }
+
   GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
               "Latency too high. Test failed. (Phase: %d. Received: %lu\n",
-              phase, num_received);
+              phase,
+              num_received);
   ret = 2;
   GNUNET_SCHEDULER_shutdown ();
 }
@@ -220,10 +231,7 @@ size_test (void *cls)
   GNUNET_free (payload);
   ack += 5;
   num_sent++;
-  if (NULL == to_task)
-    to_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
-                                            &latency_timeout,
-                                            NULL);
+  timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS);
   if (ack < 64000)
     active_task = GNUNET_SCHEDULER_add_now (&size_test,
                                             NULL);
@@ -242,10 +250,7 @@ long_test (void *cls)
                                                         LONG_MESSAGE_SIZE);
   num_sent++;
   GNUNET_free (payload);
-  if (NULL == to_task)
-    to_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
-                                            &latency_timeout,
-                                            NULL);
+  timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS);
   if (num_sent == BURST_PACKETS)
     return;
   active_task = GNUNET_SCHEDULER_add_now (&long_test,
@@ -265,10 +270,7 @@ short_test (void *cls)
                                                         SHORT_MESSAGE_SIZE);
   num_sent++;
   GNUNET_free (payload);
-  if (NULL == to_task)
-    to_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
-                                            &latency_timeout,
-                                            NULL);
+  timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS);
   if (num_sent >= BURST_PACKETS)
     return;
   active_task = GNUNET_SCHEDULER_add_now (&short_test,
@@ -300,6 +302,11 @@ add_queue_cb (void *cls,
   start_short = GNUNET_TIME_absolute_get ();
   my_tc = tc_queue;
   phase = TP_BURST_SHORT;
+  timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS);
+  GNUNET_assert (NULL == to_task);
+  to_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
+                                          &latency_timeout,
+                                          NULL);
   GNUNET_assert (NULL == active_task);
   active_task = GNUNET_SCHEDULER_add_now (&short_test,
                                           NULL);
@@ -347,6 +354,8 @@ incoming_message_cb (void *cls,
                 "unexpected receiver...\n");
     return;
   }
+  /* Reset timeout */
+  timeout = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_SECONDS);
   switch (phase)
   {
   case TP_BURST_SHORT:
@@ -374,11 +383,6 @@ incoming_message_cb (void *cls,
         num_sent = 0;
         avg_latency = 0;
         num_received = 0;
-        if (NULL != to_task)
-        {
-          GNUNET_SCHEDULER_cancel (to_task);
-          to_task = NULL;
-        }
         active_task = GNUNET_SCHEDULER_add_now (&long_test,
                                                 NULL);
       }
@@ -414,11 +418,6 @@ incoming_message_cb (void *cls,
         num_received = 0;
         num_sent = 0;
         avg_latency = 0;
-        if (NULL != to_task)
-        {
-          GNUNET_SCHEDULER_cancel (to_task);
-          to_task = NULL;
-        }
         active_task = GNUNET_SCHEDULER_add_now (&size_test,
                                                 NULL);
       }
@@ -440,11 +439,6 @@ incoming_message_cb (void *cls,
         num_received = 0;
         num_sent = 0;
         avg_latency = 0;
-        if (NULL != to_task)
-        {
-          GNUNET_SCHEDULER_cancel (to_task);
-          to_task = NULL;
-        }
         iterations_left--;
         if (0 != iterations_left)
         {
@@ -460,14 +454,6 @@ incoming_message_cb (void *cls,
       break;
     }
   }
-  /* Reset timeout */
-  if (NULL != to_task)
-  {
-    GNUNET_SCHEDULER_cancel (to_task);
-    to_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
-                                            &latency_timeout,
-                                            NULL);
-  }
 }
 
 

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



reply via email to

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