summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-04-01 10:57:04 +0200
committerChristian Grothoff <christian@grothoff.org>2021-04-01 10:57:04 +0200
commit7c485a21537c13132fadefae1787bd01c1bc195a (patch)
treeb7671009a5a35bc9304c27cc0b49f38ff213c5d2
parentec0b1b512c45b2ea9476e74d996444c92387b116 (diff)
downloadexchange-7c485a21537c13132fadefae1787bd01c1bc195a.tar.gz
exchange-7c485a21537c13132fadefae1787bd01c1bc195a.tar.bz2
exchange-7c485a21537c13132fadefae1787bd01c1bc195a.zip
fix overflow
-rw-r--r--src/lib/exchange_api_handle.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index a6e6e9a4d..fbb33eb23 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -1863,8 +1863,14 @@ TALER_EXCHANGE_connect (
static long
get_keys_timeout_seconds (struct TALER_EXCHANGE_Handle *exchange)
{
- return GNUNET_MIN (60,
- 5 + (1L << exchange->keys_error_count));
+ unsigned int kec;
+
+ /* if retry counter >= 8, do not bother to go further, we
+ stop the exponential back-off at 128 anyway. */
+ kec = GNUNET_MIN (7,
+ exchange->keys_error_count);
+ return GNUNET_MIN (120,
+ 5 + (1L << kec));
}