lower backoff threshold

This commit is contained in:
Florian Dold 2018-09-26 23:24:24 +02:00
parent 3ab7f8b840
commit 9e55caf92c
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B
7 changed files with 56 additions and 7 deletions

View File

@ -0,0 +1,38 @@
/*
This file is part of TALER
Copyright (C) 2014-2018 GNUnet e.V.
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 3, or (at your option) any later version.
TALER is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
TALER; see the file COPYING. If not, see
<http://www.gnu.org/licenses/>
*/
/**
* @file exchange-lib/backoff.h
* @brief backoff computation for the exchange lib
* @author Florian Dold
*/
#ifndef _TALER_BACKOFF_H
#define _TALER_BACKOFF_H
#include "platform.h"
#include <gnunet/gnunet_time_lib.h>
/**
* Random exponential backoff used in the exchange lib.
*/
#define EXCHANGE_LIB_BACKOFF(r) GNUNET_TIME_randomized_backoff ( \
(r), \
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2));
#endif

View File

@ -21,6 +21,10 @@
* @author Florian Dold
*/
#ifndef _TALER_CURL_DEFAULTS_H
#define _TALER_CURL_DEFAULTS_H
#include "platform.h"
#include <gnunet/gnunet_curl_lib.h>
@ -33,3 +37,5 @@
*/
CURL *
TEL_curl_easy_get (char *url);
#endif /* _TALER_CURL_DEFAULTS_H */

View File

@ -28,6 +28,7 @@
#include "taler_signatures.h"
#include "exchange_api_handle.h"
#include "curl_defaults.h"
#include "backoff.h"
/**
* Which revision of the Taler protocol is implemented
@ -848,7 +849,7 @@ keys_completed_cb (void *cls,
free_keys_request (kr);
exchange->kr = NULL;
GNUNET_assert (NULL == exchange->retry_task);
exchange->retry_delay = GNUNET_TIME_randomized_backoff (exchange->retry_delay);
exchange->retry_delay = EXCHANGE_LIB_BACKOFF (exchange->retry_delay);
exchange->retry_task = GNUNET_SCHEDULER_add_delayed (exchange->retry_delay,
&request_keys,
exchange);

View File

@ -29,6 +29,7 @@
#include "exchange_api_handle.h"
#include "taler_testing_lib.h"
#include "taler_signatures.h"
#include "backoff.h"
/**
@ -181,7 +182,7 @@ deposit_cb (void *cls,
if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec)
ds->backoff = GNUNET_TIME_UNIT_ZERO;
else
ds->backoff = GNUNET_TIME_randomized_backoff (ds->backoff);
ds->backoff = EXCHANGE_LIB_BACKOFF (ds->backoff);
ds->retry_task = GNUNET_SCHEDULER_add_delayed (ds->backoff,
&do_retry,
ds);

View File

@ -32,6 +32,7 @@
#include "taler_signatures.h"
#include "taler_testing_lib.h"
#include "taler_testing_bank_lib.h"
#include "backoff.h"
/**
* State for a "fakebank transfer" CMD.
@ -212,7 +213,7 @@ add_incoming_cb (void *cls,
if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec)
fts->backoff = GNUNET_TIME_UNIT_ZERO;
else
fts->backoff = GNUNET_TIME_randomized_backoff (fts->backoff);
fts->backoff = EXCHANGE_LIB_BACKOFF (fts->backoff);
fts->retry_task = GNUNET_SCHEDULER_add_delayed (fts->backoff,
&do_retry,
fts);

View File

@ -29,6 +29,7 @@
#include "exchange_api_handle.h"
#include "taler_testing_lib.h"
#include "taler_signatures.h"
#include "backoff.h"
/**
* Data for a coin to be melted.
@ -322,7 +323,7 @@ reveal_cb (void *cls,
if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec)
rrs->backoff = GNUNET_TIME_UNIT_ZERO;
else
rrs->backoff = GNUNET_TIME_randomized_backoff (rrs->backoff);
rrs->backoff = EXCHANGE_LIB_BACKOFF (rrs->backoff);
rrs->retry_task = GNUNET_SCHEDULER_add_delayed (rrs->backoff,
&do_reveal_retry,
rrs);
@ -551,7 +552,7 @@ link_cb (void *cls,
if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec)
rls->backoff = GNUNET_TIME_UNIT_ZERO;
else
rls->backoff = GNUNET_TIME_randomized_backoff (rls->backoff);
rls->backoff = EXCHANGE_LIB_BACKOFF (rls->backoff);
rls->retry_task = GNUNET_SCHEDULER_add_delayed (rls->backoff,
&do_link_retry,
rls);
@ -837,7 +838,7 @@ melt_cb (void *cls,
if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec)
rms->backoff = GNUNET_TIME_UNIT_ZERO;
else
rms->backoff = GNUNET_TIME_randomized_backoff (rms->backoff);
rms->backoff = EXCHANGE_LIB_BACKOFF (rms->backoff);
rms->retry_task = GNUNET_SCHEDULER_add_delayed (rms->backoff,
&do_melt_retry,
rms);

View File

@ -29,6 +29,7 @@
#include "exchange_api_handle.h"
#include "taler_signatures.h"
#include "taler_testing_lib.h"
#include "backoff.h"
@ -183,7 +184,7 @@ reserve_withdraw_cb (void *cls,
if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec)
ws->backoff = GNUNET_TIME_UNIT_ZERO;
else
ws->backoff = GNUNET_TIME_randomized_backoff (ws->backoff);
ws->backoff = EXCHANGE_LIB_BACKOFF (ws->backoff);
ws->retry_task = GNUNET_SCHEDULER_add_delayed (ws->backoff,
&do_retry,
ws);