gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: fix #7029


From: gnunet
Subject: [gnunet] branch master updated: fix #7029
Date: Wed, 06 Oct 2021 18:53:44 +0200

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

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 6ef071b8c fix #7029
6ef071b8c is described below

commit 6ef071b8ccea72da6a9e1eee6483c326b6ebc082
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Oct 6 18:53:37 2021 +0200

    fix #7029
---
 src/dht/gnunet-service-dht_neighbours.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/dht/gnunet-service-dht_neighbours.c 
b/src/dht/gnunet-service-dht_neighbours.c
index ca255310c..6465d8d57 100644
--- a/src/dht/gnunet-service-dht_neighbours.c
+++ b/src/dht/gnunet-service-dht_neighbours.c
@@ -844,6 +844,10 @@ get_forward_count (uint32_t hop_count,
   uint32_t forward_count;
   float target_value;
 
+  if (0 == target_replication)
+    target_replication = 1; /* 0 is verboten */
+  if (target_replication > MAXIMUM_REPLICATION_LEVEL)
+    target_replication = MAXIMUM_REPLICATION_LEVEL;
   if (hop_count > GDS_NSE_get () * 4.0)
   {
     /* forcefully terminate */
@@ -864,6 +868,8 @@ get_forward_count (uint32_t hop_count,
     1 + (target_replication - 1.0) / (GDS_NSE_get ()
                                       + ((float) (target_replication - 1.0)
                                          * hop_count));
+
+
   /* Set forward count to floor of target_value */
   forward_count = (uint32_t) target_value;
   /* Subtract forward_count (floor) from target_value (yields value between 0 
and 1) */
@@ -872,7 +878,8 @@ get_forward_count (uint32_t hop_count,
     GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX);
   if (random_value < (target_value * UINT32_MAX))
     forward_count++;
-  return forward_count;
+  return GNUNET_MIN (forward_count,
+                     MAXIMUM_REPLICATION_LEVEL);
 }
 
 

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