summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-12-14 19:19:32 +0100
committerChristian Grothoff <christian@grothoff.org>2021-12-14 19:19:32 +0100
commit36c2bb7d41b95564652a66b0de40527f78022582 (patch)
tree80c685dec5c3c8291a4f55076e31488d3ff76138 /src/backend
parentfbe1514b2241ec77af20f5d8a50183fcaa1155c6 (diff)
downloadanastasis-36c2bb7d41b95564652a66b0de40527f78022582.tar.gz
anastasis-36c2bb7d41b95564652a66b0de40527f78022582.tar.bz2
anastasis-36c2bb7d41b95564652a66b0de40527f78022582.zip
-fixing FTBFS for v11
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/anastasis-httpd_policy.c2
-rw-r--r--src/backend/anastasis-httpd_policy_upload.c32
-rw-r--r--src/backend/anastasis-httpd_truth.c22
3 files changed, 30 insertions, 26 deletions
diff --git a/src/backend/anastasis-httpd_policy.c b/src/backend/anastasis-httpd_policy.c
index 165be44..6e206a2 100644
--- a/src/backend/anastasis-httpd_policy.c
+++ b/src/backend/anastasis-httpd_policy.c
@@ -170,7 +170,7 @@ AH_policy_get (struct MHD_Connection *connection,
enum ANASTASIS_DB_AccountStatus as;
MHD_RESULT ret;
uint32_t version;
- struct GNUNET_TIME_Absolute expiration;
+ struct GNUNET_TIME_Timestamp expiration;
as = db->lookup_account (db->cls,
account_pub,
diff --git a/src/backend/anastasis-httpd_policy_upload.c b/src/backend/anastasis-httpd_policy_upload.c
index 0f9d8d6..b9ab266 100644
--- a/src/backend/anastasis-httpd_policy_upload.c
+++ b/src/backend/anastasis-httpd_policy_upload.c
@@ -114,7 +114,7 @@ struct PolicyUploadContext
* Timestamp of the order in @e payment_identifier. Used to
* select the most recent unpaid offer.
*/
- struct GNUNET_TIME_Absolute existing_pi_timestamp;
+ struct GNUNET_TIME_Timestamp existing_pi_timestamp;
/**
* When does the operation timeout?
@@ -125,13 +125,13 @@ struct PolicyUploadContext
* How long must the account be valid? Determines whether we should
* trigger payment, and if so how much.
*/
- struct GNUNET_TIME_Absolute end_date;
+ struct GNUNET_TIME_Timestamp end_date;
/**
* How long is the account already valid?
* Determines how much the user needs to pay.
*/
- struct GNUNET_TIME_Absolute paid_until;
+ struct GNUNET_TIME_Timestamp paid_until;
/**
* Expected total upload size.
@@ -475,7 +475,7 @@ check_payment_cb (void *cls,
case TALER_MERCHANT_OSC_CLAIMED:
break;
}
- if (0 != puc->existing_pi_timestamp.abs_value_us)
+ if (! GNUNET_TIME_absolute_is_zero (puc->existing_pi_timestamp.abs_time))
{
/* repeat payment request */
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -815,8 +815,8 @@ AH_handler_policy_post (
}
else
{
- puc->timeout = GNUNET_TIME_relative_to_absolute
- (CHECK_PAYMENT_GENERIC_TIMEOUT);
+ puc->timeout = GNUNET_TIME_relative_to_absolute (
+ CHECK_PAYMENT_GENERIC_TIMEOUT);
}
}
@@ -848,7 +848,7 @@ AH_handler_policy_post (
{
years = 0;
}
- puc->end_date = GNUNET_TIME_relative_to_absolute (
+ puc->end_date = GNUNET_TIME_relative_to_timestamp (
GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_YEARS,
years));
}
@@ -860,7 +860,7 @@ AH_handler_policy_post (
{
struct GNUNET_TIME_Relative rem;
- rem = GNUNET_TIME_absolute_get_remaining (puc->end_date);
+ rem = GNUNET_TIME_absolute_get_remaining (puc->end_date.abs_time);
puc->years_to_pay = rem.rel_value_us
/ GNUNET_TIME_UNIT_YEARS.rel_value_us;
if (0 != (rem.rel_value_us % GNUNET_TIME_UNIT_YEARS.rel_value_us))
@@ -943,7 +943,7 @@ AH_handler_policy_post (
GNUNET_STRINGS_relative_time_to_string (rel,
GNUNET_YES),
ANASTASIS_MAX_YEARS_STORAGE);
- puc->paid_until = GNUNET_TIME_relative_to_absolute (rel);
+ puc->paid_until = GNUNET_TIME_relative_to_timestamp (rel);
qs = db->update_lifetime (db->cls,
account_pub,
&puc->payment_identifier,
@@ -964,7 +964,7 @@ AH_handler_policy_post (
struct GNUNET_HashCode hc;
enum ANASTASIS_DB_AccountStatus as;
uint32_t version;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Timestamp now;
struct GNUNET_TIME_Relative rem;
as = db->lookup_account (db->cls,
@@ -972,11 +972,13 @@ AH_handler_policy_post (
&puc->paid_until,
&hc,
&version);
- now = GNUNET_TIME_absolute_get ();
- if (puc->paid_until.abs_value_us < now.abs_value_us)
+ now = GNUNET_TIME_timestamp_get ();
+ if (GNUNET_TIME_timestamp_cmp (puc->paid_until,
+ (<),
+ now))
puc->paid_until = now;
- rem = GNUNET_TIME_absolute_get_difference (puc->paid_until,
- puc->end_date);
+ rem = GNUNET_TIME_absolute_get_difference (puc->paid_until.abs_time,
+ puc->end_date.abs_time);
puc->years_to_pay = rem.rel_value_us
/ GNUNET_TIME_UNIT_YEARS.rel_value_us;
if (0 != (rem.rel_value_us % GNUNET_TIME_UNIT_YEARS.rel_value_us))
@@ -1122,7 +1124,7 @@ AH_handler_policy_post (
sizeof (expir_s),
"%llu",
(unsigned long long)
- (puc->paid_until.abs_value_us
+ (puc->paid_until.abs_time.abs_value_us
/ GNUNET_TIME_UNIT_SECONDS.rel_value_us));
switch (ss)
{
diff --git a/src/backend/anastasis-httpd_truth.c b/src/backend/anastasis-httpd_truth.c
index 52d5dab..cbf13be 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -778,7 +778,7 @@ begin_payment (struct GetContext *gc)
{
/* Create a fresh order */
json_t *order;
- struct GNUNET_TIME_Absolute pay_deadline;
+ struct GNUNET_TIME_Timestamp pay_deadline;
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK,
&gc->payment_identifier,
@@ -789,9 +789,8 @@ begin_payment (struct GetContext *gc)
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Creating fresh order `%s'\n",
order_id);
- pay_deadline = GNUNET_TIME_relative_to_absolute (
+ pay_deadline = GNUNET_TIME_relative_to_timestamp (
ANASTASIS_CHALLENGE_OFFER_LIFETIME);
- GNUNET_TIME_round_abs (&pay_deadline);
order = GNUNET_JSON_PACK (
TALER_JSON_pack_amount ("amount",
&gc->challenge_cost),
@@ -801,8 +800,8 @@ begin_payment (struct GetContext *gc)
order_id),
GNUNET_JSON_pack_time_rel ("auto_refund",
AUTO_REFUND_TIMEOUT),
- GNUNET_JSON_pack_time_abs ("pay_deadline",
- pay_deadline));
+ GNUNET_JSON_pack_timestamp ("pay_deadline",
+ pay_deadline));
gc->po = TALER_MERCHANT_orders_post2 (AH_ctx,
AH_backend_url,
order,
@@ -1006,14 +1005,14 @@ static enum GNUNET_GenericReturnValue
rate_limit (struct GetContext *gc)
{
enum GNUNET_DB_QueryStatus qs;
- struct GNUNET_TIME_Absolute rt;
+ struct GNUNET_TIME_Timestamp rt;
uint64_t code;
enum ANASTASIS_DB_CodeStatus cs;
struct GNUNET_HashCode hc;
bool satisfied;
uint64_t dummy;
- rt = GNUNET_TIME_UNIT_FOREVER_ABS;
+ rt = GNUNET_TIME_UNIT_FOREVER_TS;
qs = db->create_challenge_code (db->cls,
&gc->truth_uuid,
MAX_QUESTION_FREQ,
@@ -1618,7 +1617,7 @@ AH_handler_truth_get (
/* Setup challenge and begin authorization process */
{
- struct GNUNET_TIME_Absolute transmission_date;
+ struct GNUNET_TIME_Timestamp transmission_date;
enum GNUNET_DB_QueryStatus qs;
qs = db->create_challenge_code (db->cls,
@@ -1652,8 +1651,11 @@ AH_handler_truth_get (
break;
}
- if (GNUNET_TIME_absolute_get_duration (transmission_date).rel_value_us <
- gc->authorization->code_retransmission_frequency.rel_value_us)
+ if (GNUNET_TIME_relative_cmp (GNUNET_TIME_absolute_get_duration (
+ transmission_date.abs_time),
+ (<),
+ gc->authorization->
+ code_retransmission_frequency) )
{
/* Too early for a retransmission! */
GNUNET_free (decrypted_truth);