-minor fixes
This commit is contained in:
parent
9086ed15c1
commit
ed6ab2f91a
@ -24,7 +24,7 @@
|
|||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "taler_curl_lib.h"
|
#include "taler_curl_lib.h"
|
||||||
|
|
||||||
#if COMPRESS_BODIES
|
#if TALER_CURL_COMPRESS_BODIES
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ TALER_curl_easy_post (struct TALER_CURL_PostContext *ctx,
|
|||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
slen = strlen (str);
|
slen = strlen (str);
|
||||||
#if COMPRESS_BODIES
|
#if TALER_CURL_COMPRESS_BODIES
|
||||||
{
|
{
|
||||||
Bytef *cbuf;
|
Bytef *cbuf;
|
||||||
uLongf cbuf_size;
|
uLongf cbuf_size;
|
||||||
|
@ -28,10 +28,10 @@
|
|||||||
#include "taler_bank_service.h"
|
#include "taler_bank_service.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* What is the maximum batch size we use for credit history
|
* What is the default batch size we use for credit history
|
||||||
* requests with the bank. See `batch_size` below.
|
* requests with the bank. See `batch_size` below.
|
||||||
*/
|
*/
|
||||||
#define MAXIMUM_BATCH_SIZE 1024
|
#define DEFAULT_BATCH_SIZE (4 * 1024)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How often will we retry a request (given certain
|
* How often will we retry a request (given certain
|
||||||
@ -160,6 +160,11 @@ static struct Shard *shard;
|
|||||||
*/
|
*/
|
||||||
static struct GNUNET_CURL_Context *ctx;
|
static struct GNUNET_CURL_Context *ctx;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Randomized back-off we use on serialization errors.
|
||||||
|
*/
|
||||||
|
static struct GNUNET_TIME_Relative serialization_delay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scheduler context for running the @e ctx.
|
* Scheduler context for running the @e ctx.
|
||||||
*/
|
*/
|
||||||
@ -189,11 +194,9 @@ static struct GNUNET_TIME_Relative transfer_idle_sleep_interval;
|
|||||||
static struct GNUNET_TIME_Relative shard_delay;
|
static struct GNUNET_TIME_Relative shard_delay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modulus to apply to group shards. The shard size must ultimately be a
|
* Size of the shards.
|
||||||
* multiple of the batch size. Thus, if this is not a multiple of the
|
|
||||||
* #MAXIMUM_BATCH_SIZE, the batch size will be set to the #shard_size.
|
|
||||||
*/
|
*/
|
||||||
static unsigned int shard_size = MAXIMUM_BATCH_SIZE;
|
static unsigned int shard_size = DEFAULT_BATCH_SIZE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How many workers should we plan our scheduling with?
|
* How many workers should we plan our scheduling with?
|
||||||
@ -313,7 +316,10 @@ commit_or_warn (void)
|
|||||||
|
|
||||||
qs = db_plugin->commit (db_plugin->cls);
|
qs = db_plugin->commit (db_plugin->cls);
|
||||||
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
|
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
|
||||||
|
{
|
||||||
|
serialization_delay = GNUNET_TIME_UNIT_ZERO;
|
||||||
return qs;
|
return qs;
|
||||||
|
}
|
||||||
GNUNET_log ((GNUNET_DB_STATUS_SOFT_ERROR == qs)
|
GNUNET_log ((GNUNET_DB_STATUS_SOFT_ERROR == qs)
|
||||||
? GNUNET_ERROR_TYPE_INFO
|
? GNUNET_ERROR_TYPE_INFO
|
||||||
: GNUNET_ERROR_TYPE_ERROR,
|
: GNUNET_ERROR_TYPE_ERROR,
|
||||||
@ -765,16 +771,14 @@ select_shard (void *cls)
|
|||||||
case GNUNET_DB_STATUS_SOFT_ERROR:
|
case GNUNET_DB_STATUS_SOFT_ERROR:
|
||||||
/* try again */
|
/* try again */
|
||||||
{
|
{
|
||||||
static struct GNUNET_TIME_Relative delay;
|
serialization_delay = GNUNET_TIME_randomized_backoff (serialization_delay,
|
||||||
|
|
||||||
delay = GNUNET_TIME_randomized_backoff (delay,
|
|
||||||
GNUNET_TIME_UNIT_SECONDS);
|
GNUNET_TIME_UNIT_SECONDS);
|
||||||
GNUNET_assert (NULL == task);
|
GNUNET_assert (NULL == task);
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
|
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
|
||||||
"Serialization failure, trying again in %s!\n",
|
"Serialization failure, trying again in %s!\n",
|
||||||
GNUNET_STRINGS_relative_time_to_string (delay,
|
GNUNET_STRINGS_relative_time_to_string (serialization_delay,
|
||||||
GNUNET_YES));
|
GNUNET_YES));
|
||||||
task = GNUNET_SCHEDULER_add_delayed (delay,
|
task = GNUNET_SCHEDULER_add_delayed (serialization_delay,
|
||||||
&select_shard,
|
&select_shard,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
/**
|
/**
|
||||||
* Should we compress PUT/POST bodies with 'deflate' encoding?
|
* Should we compress PUT/POST bodies with 'deflate' encoding?
|
||||||
*/
|
*/
|
||||||
#define COMPRESS_BODIES 1
|
#define TALER_CURL_COMPRESS_BODIES 1
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State used for #TALER_curl_easy_post() and
|
* State used for #TALER_curl_easy_post() and
|
||||||
|
Loading…
Reference in New Issue
Block a user