diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-10-26 22:13:01 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-10-26 22:13:01 +0000 |
commit | 64d3e46cfb99a711e500fa1f114e7c44bdf10040 (patch) | |
tree | 83093d92761d5c1b8b2fded713adaa19af29274c /src/include/gnunet_time_lib.h | |
parent | ef6f05f63769263a5201636c4b7f71eaa455cdf3 (diff) | |
download | gnunet-64d3e46cfb99a711e500fa1f114e7c44bdf10040.tar.gz gnunet-64d3e46cfb99a711e500fa1f114e7c44bdf10040.zip |
-bugfixes, code cleanup
Diffstat (limited to 'src/include/gnunet_time_lib.h')
-rw-r--r-- | src/include/gnunet_time_lib.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/include/gnunet_time_lib.h b/src/include/gnunet_time_lib.h index da22ab31e..d131e4eef 100644 --- a/src/include/gnunet_time_lib.h +++ b/src/include/gnunet_time_lib.h | |||
@@ -150,6 +150,22 @@ GNUNET_NETWORK_STRUCT_END | |||
150 | #define GNUNET_TIME_UNIT_FOREVER_ABS GNUNET_TIME_absolute_get_forever_ () | 150 | #define GNUNET_TIME_UNIT_FOREVER_ABS GNUNET_TIME_absolute_get_forever_ () |
151 | 151 | ||
152 | 152 | ||
153 | |||
154 | /** | ||
155 | * Threshold after which exponential backoff should not increase (15 m). | ||
156 | */ | ||
157 | #define GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15) | ||
158 | |||
159 | |||
160 | /** | ||
161 | * Perform our standard exponential back-off calculation, starting at 1mst | ||
162 | * and then going by a factor of 2 up unto a maximum of 1s. | ||
163 | * | ||
164 | * @param r current backoff time, initially zero | ||
165 | */ | ||
166 | #define GNUNET_TIME_STD_BACKOFF(r) GNUNET_TIME_relative_min (GNUNET_TIME_STD_EXPONENTIAL_BACKOFF_THRESHOLD, \ | ||
167 | GNUNET_TIME_relative_multiply (GNUNET_TIME_relative_max (GNUNET_TIME_UNIT_MILLISECONDS, (r)), 2)); | ||
168 | |||
153 | /** | 169 | /** |
154 | * Return relative time of 0ms. | 170 | * Return relative time of 0ms. |
155 | */ | 171 | */ |