From 749d9615d12127a33445ceae21a8fa388d2f64a1 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 19 Mar 2020 19:17:56 +0100 Subject: concurrency requires strtok_r --- src/testing/testing_api_cmd_refresh.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'src/testing/testing_api_cmd_refresh.c') diff --git a/src/testing/testing_api_cmd_refresh.c b/src/testing/testing_api_cmd_refresh.c index dd861fae1..2f91df377 100644 --- a/src/testing/testing_api_cmd_refresh.c +++ b/src/testing/testing_api_cmd_refresh.c @@ -28,6 +28,10 @@ #include "taler_signatures.h" #include "backoff.h" +/** + * How often do we retry before giving up? + */ +#define NUM_RETRIES 5 /** * Information about a fresh coin generated by the refresh @@ -149,9 +153,9 @@ struct RefreshMeltState unsigned int double_melt; /** - * Should we retry on (transient) failures? + * How often should we retry on (transient) failures? */ - int do_retry; + unsigned int do_retry; /** * Set by the melt callback as it comes from the exchange. @@ -210,9 +214,9 @@ struct RefreshRevealState unsigned int expected_response_code; /** - * Should we retry on (transient) failures? + * How often should we retry on (transient) failures? */ - int do_retry; + unsigned int do_retry; }; @@ -253,9 +257,9 @@ struct RefreshLinkState unsigned int expected_response_code; /** - * Should we retry on (transient) failures? + * How often should we retry on (transient) failures? */ - int do_retry; + unsigned int do_retry; }; @@ -322,8 +326,9 @@ reveal_cb (void *cls, rrs->rrh = NULL; if (rrs->expected_response_code != http_status) { - if (GNUNET_YES == rrs->do_retry) + if (0 != rrs->do_retry) { + rrs->do_retry--; if ( (0 == http_status) || (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) || (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) @@ -548,8 +553,9 @@ link_cb (void *cls, rls->rlh = NULL; if (rls->expected_response_code != http_status) { - if (GNUNET_YES == rls->do_retry) + if (0 != rls->do_retry) { + rls->do_retry--; if ( (0 == http_status) || (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) || (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) @@ -830,8 +836,9 @@ melt_cb (void *cls, rms->rmh = NULL; if (rms->expected_response_code != http_status) { - if (GNUNET_YES == rms->do_retry) + if (0 != rms->do_retry) { + rms->do_retry--; if ( (0 == http_status) || (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) || (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) @@ -1246,7 +1253,7 @@ TALER_TESTING_cmd_melt_with_retry (struct TALER_TESTING_Command cmd) GNUNET_assert (&melt_run == cmd.run); rms = cmd.cls; - rms->do_retry = GNUNET_YES; + rms->do_retry = NUM_RETRIES; return cmd; } @@ -1356,7 +1363,7 @@ TALER_TESTING_cmd_refresh_reveal_with_retry (struct TALER_TESTING_Command cmd) GNUNET_assert (&refresh_reveal_run == cmd.run); rrs = cmd.cls; - rrs->do_retry = GNUNET_YES; + rrs->do_retry = NUM_RETRIES; return cmd; } @@ -1405,6 +1412,6 @@ TALER_TESTING_cmd_refresh_link_with_retry (struct TALER_TESTING_Command cmd) GNUNET_assert (&refresh_link_run == cmd.run); rls = cmd.cls; - rls->do_retry = GNUNET_YES; + rls->do_retry = NUM_RETRIES; return cmd; } -- cgit v1.2.3