diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-26 17:34:51 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-26 17:34:51 +0200 |
commit | ed6b45c02fabd040f25c6ea3e7c5d1e03c9725e8 (patch) | |
tree | 38dd75e6544c0e79ecf580e9fba53935c902baf8 /src/include | |
parent | e67f1331d12caef3731a41700deb89bd44f1cf3d (diff) | |
download | gnunet-ed6b45c02fabd040f25c6ea3e7c5d1e03c9725e8.tar.gz gnunet-ed6b45c02fabd040f25c6ea3e7c5d1e03c9725e8.zip |
randomized exponential backoff
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_time_lib.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/include/gnunet_time_lib.h b/src/include/gnunet_time_lib.h index 2fc20d2cd..41840e9a3 100644 --- a/src/include/gnunet_time_lib.h +++ b/src/include/gnunet_time_lib.h | |||
@@ -173,6 +173,19 @@ GNUNET_NETWORK_STRUCT_END | |||
173 | #define GNUNET_TIME_STD_BACKOFF(r) GNUNET_TIME_relative_min (GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD, \ | 173 | #define GNUNET_TIME_STD_BACKOFF(r) GNUNET_TIME_relative_min (GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD, \ |
174 | GNUNET_TIME_relative_multiply (GNUNET_TIME_relative_max (GNUNET_TIME_UNIT_MILLISECONDS, (r)), 2)); | 174 | GNUNET_TIME_relative_multiply (GNUNET_TIME_relative_max (GNUNET_TIME_UNIT_MILLISECONDS, (r)), 2)); |
175 | 175 | ||
176 | |||
177 | /** | ||
178 | * Randomized exponential back-off, starting at 1 ms | ||
179 | * and going up by a factor of 2+r, where 0 <= r <= 0.5, up | ||
180 | * to a maximum of 15 m. | ||
181 | * | ||
182 | * @param r current backoff time, initially zero | ||
183 | * @return the next backoff time | ||
184 | */ | ||
185 | struct GNUNET_TIME_Relative | ||
186 | GNUNET_TIME_randomized_backoff(struct GNUNET_TIME_Relative rt); | ||
187 | |||
188 | |||
176 | /** | 189 | /** |
177 | * Return relative time of 0ms. | 190 | * Return relative time of 0ms. |
178 | */ | 191 | */ |