[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: configurable threshold for
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: configurable threshold for randomized backoff |
Date: |
Wed, 26 Sep 2018 23:00:03 +0200 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 28273c708 configurable threshold for randomized backoff
28273c708 is described below
commit 28273c70836e834793cfb03b82325e38e566e65a
Author: Florian Dold <address@hidden>
AuthorDate: Wed Sep 26 22:58:21 2018 +0200
configurable threshold for randomized backoff
---
src/include/gnunet_time_lib.h | 7 ++++---
src/util/time.c | 9 ++++++---
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/include/gnunet_time_lib.h b/src/include/gnunet_time_lib.h
index 41840e9a3..c7a06ba23 100644
--- a/src/include/gnunet_time_lib.h
+++ b/src/include/gnunet_time_lib.h
@@ -177,13 +177,14 @@ GNUNET_NETWORK_STRUCT_END
/**
* Randomized exponential back-off, starting at 1 ms
* and going up by a factor of 2+r, where 0 <= r <= 0.5, up
- * to a maximum of 15 m.
+ * to a maximum of the given threshold.
*
- * @param r current backoff time, initially zero
+ * @param rt current backoff time, initially zero
+ * @param threshold maximum value for backoff
* @return the next backoff time
*/
struct GNUNET_TIME_Relative
-GNUNET_TIME_randomized_backoff(struct GNUNET_TIME_Relative rt);
+GNUNET_TIME_randomized_backoff(struct GNUNET_TIME_Relative rt, struct
GNUNET_TIME_Relative threshold);
/**
diff --git a/src/util/time.c b/src/util/time.c
index 0c177c381..b02c43c1b 100644
--- a/src/util/time.c
+++ b/src/util/time.c
@@ -737,13 +737,14 @@ GNUNET_TIME_year_to_time (unsigned int year)
/**
* Randomized exponential back-off, starting at 1 ms
* and going up by a factor of 2+r, where 0 <= r <= 0.5, up
- * to a maximum of 15 m.
+ * to a maximum of the given threshold.
*
* @param r current backoff time, initially zero
+ * @param threshold maximum value for backoff
* @return the next backoff time
*/
struct GNUNET_TIME_Relative
-GNUNET_TIME_randomized_backoff(struct GNUNET_TIME_Relative rt)
+GNUNET_TIME_randomized_backoff(struct GNUNET_TIME_Relative rt, struct
GNUNET_TIME_Relative threshold)
{
double r = (rand() % 500) / 1000.0;
struct GNUNET_TIME_Relative t;
@@ -751,9 +752,11 @@ GNUNET_TIME_randomized_backoff(struct GNUNET_TIME_Relative
rt)
t = relative_multiply_double (GNUNET_TIME_relative_max
(GNUNET_TIME_UNIT_MILLISECONDS,
rt),
2 + r);
- return GNUNET_TIME_relative_min
(GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD,
+ return GNUNET_TIME_relative_min (threshold,
t);
}
+
+
/* end of time.c */
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: configurable threshold for randomized backoff,
gnunet <=