lower backoff threshold
This commit is contained in:
parent
3ab7f8b840
commit
9e55caf92c
38
src/exchange-lib/backoff.h
Normal file
38
src/exchange-lib/backoff.h
Normal 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
|
@ -21,6 +21,10 @@
|
|||||||
* @author Florian Dold
|
* @author Florian Dold
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef _TALER_CURL_DEFAULTS_H
|
||||||
|
#define _TALER_CURL_DEFAULTS_H
|
||||||
|
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include <gnunet/gnunet_curl_lib.h>
|
#include <gnunet/gnunet_curl_lib.h>
|
||||||
|
|
||||||
@ -33,3 +37,5 @@
|
|||||||
*/
|
*/
|
||||||
CURL *
|
CURL *
|
||||||
TEL_curl_easy_get (char *url);
|
TEL_curl_easy_get (char *url);
|
||||||
|
|
||||||
|
#endif /* _TALER_CURL_DEFAULTS_H */
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "taler_signatures.h"
|
#include "taler_signatures.h"
|
||||||
#include "exchange_api_handle.h"
|
#include "exchange_api_handle.h"
|
||||||
#include "curl_defaults.h"
|
#include "curl_defaults.h"
|
||||||
|
#include "backoff.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Which revision of the Taler protocol is implemented
|
* Which revision of the Taler protocol is implemented
|
||||||
@ -848,7 +849,7 @@ keys_completed_cb (void *cls,
|
|||||||
free_keys_request (kr);
|
free_keys_request (kr);
|
||||||
exchange->kr = NULL;
|
exchange->kr = NULL;
|
||||||
GNUNET_assert (NULL == exchange->retry_task);
|
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,
|
exchange->retry_task = GNUNET_SCHEDULER_add_delayed (exchange->retry_delay,
|
||||||
&request_keys,
|
&request_keys,
|
||||||
exchange);
|
exchange);
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "exchange_api_handle.h"
|
#include "exchange_api_handle.h"
|
||||||
#include "taler_testing_lib.h"
|
#include "taler_testing_lib.h"
|
||||||
#include "taler_signatures.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)
|
if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec)
|
||||||
ds->backoff = GNUNET_TIME_UNIT_ZERO;
|
ds->backoff = GNUNET_TIME_UNIT_ZERO;
|
||||||
else
|
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,
|
ds->retry_task = GNUNET_SCHEDULER_add_delayed (ds->backoff,
|
||||||
&do_retry,
|
&do_retry,
|
||||||
ds);
|
ds);
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "taler_signatures.h"
|
#include "taler_signatures.h"
|
||||||
#include "taler_testing_lib.h"
|
#include "taler_testing_lib.h"
|
||||||
#include "taler_testing_bank_lib.h"
|
#include "taler_testing_bank_lib.h"
|
||||||
|
#include "backoff.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State for a "fakebank transfer" CMD.
|
* State for a "fakebank transfer" CMD.
|
||||||
@ -212,7 +213,7 @@ add_incoming_cb (void *cls,
|
|||||||
if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec)
|
if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec)
|
||||||
fts->backoff = GNUNET_TIME_UNIT_ZERO;
|
fts->backoff = GNUNET_TIME_UNIT_ZERO;
|
||||||
else
|
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,
|
fts->retry_task = GNUNET_SCHEDULER_add_delayed (fts->backoff,
|
||||||
&do_retry,
|
&do_retry,
|
||||||
fts);
|
fts);
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "exchange_api_handle.h"
|
#include "exchange_api_handle.h"
|
||||||
#include "taler_testing_lib.h"
|
#include "taler_testing_lib.h"
|
||||||
#include "taler_signatures.h"
|
#include "taler_signatures.h"
|
||||||
|
#include "backoff.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Data for a coin to be melted.
|
* Data for a coin to be melted.
|
||||||
@ -322,7 +323,7 @@ reveal_cb (void *cls,
|
|||||||
if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec)
|
if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec)
|
||||||
rrs->backoff = GNUNET_TIME_UNIT_ZERO;
|
rrs->backoff = GNUNET_TIME_UNIT_ZERO;
|
||||||
else
|
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,
|
rrs->retry_task = GNUNET_SCHEDULER_add_delayed (rrs->backoff,
|
||||||
&do_reveal_retry,
|
&do_reveal_retry,
|
||||||
rrs);
|
rrs);
|
||||||
@ -551,7 +552,7 @@ link_cb (void *cls,
|
|||||||
if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec)
|
if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec)
|
||||||
rls->backoff = GNUNET_TIME_UNIT_ZERO;
|
rls->backoff = GNUNET_TIME_UNIT_ZERO;
|
||||||
else
|
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,
|
rls->retry_task = GNUNET_SCHEDULER_add_delayed (rls->backoff,
|
||||||
&do_link_retry,
|
&do_link_retry,
|
||||||
rls);
|
rls);
|
||||||
@ -837,7 +838,7 @@ melt_cb (void *cls,
|
|||||||
if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec)
|
if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec)
|
||||||
rms->backoff = GNUNET_TIME_UNIT_ZERO;
|
rms->backoff = GNUNET_TIME_UNIT_ZERO;
|
||||||
else
|
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,
|
rms->retry_task = GNUNET_SCHEDULER_add_delayed (rms->backoff,
|
||||||
&do_melt_retry,
|
&do_melt_retry,
|
||||||
rms);
|
rms);
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
#include "exchange_api_handle.h"
|
#include "exchange_api_handle.h"
|
||||||
#include "taler_signatures.h"
|
#include "taler_signatures.h"
|
||||||
#include "taler_testing_lib.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)
|
if (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec)
|
||||||
ws->backoff = GNUNET_TIME_UNIT_ZERO;
|
ws->backoff = GNUNET_TIME_UNIT_ZERO;
|
||||||
else
|
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,
|
ws->retry_task = GNUNET_SCHEDULER_add_delayed (ws->backoff,
|
||||||
&do_retry,
|
&do_retry,
|
||||||
ws);
|
ws);
|
||||||
|
Loading…
Reference in New Issue
Block a user