gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated (d07a2f30e -> f387a7b92)


From: gnunet
Subject: [gnunet] branch master updated (d07a2f30e -> f387a7b92)
Date: Fri, 15 Dec 2023 10:53:24 +0100

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

t3sserakt pushed a change to branch master
in repository gnunet.

    from d07a2f30e GNS: underscore prefix bug fixes
     new 656567763 Transport: Fixed counting of fragments of a message
     new 26b05be15 Transport: Introduced variable to count the round of 
fragments of a message being (re)send.
     new e22e6375d Transport: Fixed ring buffer.
     new 388952c79 Merge branch 'master' of ssh://git.gnunet.org/gnunet
     new f387a7b92 Util: Introduced GNUNET_TIME_relative_multiply_double.

The 5 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/include/gnunet_time_lib.h                    | 11 ++++++++
 src/lib/util/time.c                              |  6 ++---
 src/service/transport/gnunet-service-transport.c | 33 +++++++++++++++++-------
 3 files changed, 37 insertions(+), 13 deletions(-)

diff --git a/src/include/gnunet_time_lib.h b/src/include/gnunet_time_lib.h
index 308aadb53..88dafc62c 100644
--- a/src/include/gnunet_time_lib.h
+++ b/src/include/gnunet_time_lib.h
@@ -615,6 +615,17 @@ GNUNET_TIME_absolute_subtract (struct GNUNET_TIME_Absolute 
start,
                                struct GNUNET_TIME_Relative duration);
 
 
+/**
+ * Multiply relative time by a given factor.
+ *
+ * @param rel some duration
+ * @param factor double to multiply with
+ * @return FOREVER if rel=FOREVER or on overflow; otherwise rel*factor
+ */
+struct GNUNET_TIME_Relative
+GNUNET_TIME_relative_multiply_double (struct GNUNET_TIME_Relative rel,
+                                      double factor);
+
 /**
  * Multiply relative time by a given factor.
  *
diff --git a/src/lib/util/time.c b/src/lib/util/time.c
index 84957c6a8..1bc7baeaa 100644
--- a/src/lib/util/time.c
+++ b/src/lib/util/time.c
@@ -501,7 +501,7 @@ GNUNET_TIME_relative_multiply (struct GNUNET_TIME_Relative 
rel,
 
 
 struct GNUNET_TIME_Relative
-relative_multiply_double (struct GNUNET_TIME_Relative rel,
+GNUNET_TIME_relative_multiply_double (struct GNUNET_TIME_Relative rel,
                           double factor)
 {
   struct GNUNET_TIME_Relative out;
@@ -833,7 +833,7 @@ GNUNET_TIME_randomized_backoff (struct GNUNET_TIME_Relative 
rt,
   double r = (rand () % 500) / 1000.0;
   struct GNUNET_TIME_Relative t;
 
-  t = relative_multiply_double (
+  t = GNUNET_TIME_relative_multiply_double (
     GNUNET_TIME_relative_max (GNUNET_TIME_UNIT_MILLISECONDS, rt),
     2 + r);
   return GNUNET_TIME_relative_min (threshold, t);
@@ -852,7 +852,7 @@ GNUNET_TIME_randomize (struct GNUNET_TIME_Relative r)
 {
   double d = ((rand () % 1001) + 500) / 1000.0;
 
-  return relative_multiply_double (r, d);
+  return GNUNET_TIME_relative_multiply_double (r, d);
 }
 
 
diff --git a/src/service/transport/gnunet-service-transport.c 
b/src/service/transport/gnunet-service-transport.c
index 66f8641a2..d0d605465 100644
--- a/src/service/transport/gnunet-service-transport.c
+++ b/src/service/transport/gnunet-service-transport.c
@@ -2291,6 +2291,11 @@ struct PendingMessage
    */
   uint32_t frags_in_flight;
 
+  /**
+   * The round we are (re)-sending fragments.
+   */
+  uint32_t frags_in_flight_round;
+
   /**
    * How many fragments do we have?
    **/
@@ -3068,6 +3073,15 @@ free_pending_message (struct PendingMessage *pm)
                                   vl->pending_msg_tail,
                                   pm);
   }
+  else if (NULL != pm->frag_parent)
+  {
+    struct PendingMessage *root = pm->frag_parent;
+
+    while (NULL != root->frag_parent)
+      root = root->frag_parent;
+
+    root->frag_count--;
+  }
   while (NULL != (pa = pm->pa_head))
   {
     if (NULL == pa)
@@ -6821,7 +6835,7 @@ send_msg_from_cache (struct VirtualLink *vl)
       }
       else
       {
-        ring_buffer_copy[i] = rbe;
+        ring_buffer_copy[ring_buffer_head] = rbe;
         ring_buffer_head++;
       }
     }
@@ -6888,7 +6902,7 @@ send_msg_from_cache (struct VirtualLink *vl)
       }
       else
       {
-        ring_buffer_dv_copy[i] = pm;
+        ring_buffer_dv_copy[ring_buffer_dv_head] = pm;
         ring_buffer_dv_head++;
       }
     }
@@ -9498,6 +9512,7 @@ fragment_message (struct Queue *queue,
     uint16_t fragsize;
     uint16_t msize;
     uint16_t xoff = 0;
+    pm->frag_count++;
 
     orig = (const char *) &ff[1];
     msize = ff->bytes_msg;
@@ -9662,16 +9677,15 @@ reorder_root_pm (struct PendingMessage *pm,
 
 
 static unsigned int
-check_next_attempt_tree (struct PendingMessage *pm,
-                         struct GNUNET_TIME_Absolute next_attempt)
+check_next_attempt_tree (struct PendingMessage *pm)
 {
   struct PendingMessage *pos;
 
   pos = pm->head_frag;
   while (NULL != pos)
   {
-    if (pos->next_attempt.abs_value_us != next_attempt.abs_value_us ||
-        GNUNET_YES == check_next_attempt_tree (pos, next_attempt))
+    if (pos->frags_in_flight_round != pm->frags_in_flight_round ||
+        GNUNET_YES == check_next_attempt_tree (pos))
       return GNUNET_YES;
     pos = pos->next_frag;
   }
@@ -9733,10 +9747,10 @@ update_pm_next_attempt (struct PendingMessage *pm,
     }
 
     pm->next_attempt = root->next_attempt;
+    pm->frags_in_flight_round = root->frags_in_flight_round;
 
     if (root->bytes_msg == root->frag_off)
-      root->frags_in_flight = check_next_attempt_tree (root,
-                                                       root->next_attempt);
+      root->frags_in_flight = check_next_attempt_tree (root);
     else
       root->frags_in_flight = GNUNET_YES;
 
@@ -10257,7 +10271,6 @@ transmit_on_queue (void *cls)
       while (NULL != root->frag_parent)
         root = root->frag_parent;
 
-      root->frag_count++;
       wait_multiplier =  (unsigned int) ceil ((double) root->bytes_msg
                                               / ((double) root->frag_off
                                                  / (double) root->frag_count))
@@ -10302,7 +10315,7 @@ transmit_on_queue (void *cls)
       wait_duration, wait_multiplier);
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Waiting %s for ACK until %s\n",
-                GNUNET_STRINGS_relative_time_to_string (plus, GNUNET_YES),
+                GNUNET_STRINGS_relative_time_to_string (plus, GNUNET_NO),
                 GNUNET_STRINGS_absolute_time_to_string (next));
     update_pm_next_attempt (pm,
                             GNUNET_TIME_relative_to_absolute (

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