Merge branch 'master' of ssh://taler.net/exchange
This commit is contained in:
commit
1a2facbd2b
@ -2037,7 +2037,9 @@ postgres_reserve_get (void *cls,
|
|||||||
* @param session the database connection
|
* @param session the database connection
|
||||||
* @param reserve the reserve structure whose data will be used to update the
|
* @param reserve the reserve structure whose data will be used to update the
|
||||||
* corresponding record in the database.
|
* corresponding record in the database.
|
||||||
* @return #GNUNET_OK upon successful update; #GNUNET_SYSERR upon any error
|
* @return #GNUNET_OK upon successful update;
|
||||||
|
* #GNUNET_NO if we failed but should retry the transaction
|
||||||
|
* #GNUNET_SYSERR upon any error
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
reserves_update (void *cls,
|
reserves_update (void *cls,
|
||||||
@ -2046,21 +2048,21 @@ reserves_update (void *cls,
|
|||||||
{
|
{
|
||||||
PGresult *result;
|
PGresult *result;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (NULL == reserve)
|
|
||||||
return GNUNET_SYSERR;
|
|
||||||
struct GNUNET_PQ_QueryParam params[] = {
|
struct GNUNET_PQ_QueryParam params[] = {
|
||||||
GNUNET_PQ_query_param_absolute_time (&reserve->expiry),
|
GNUNET_PQ_query_param_absolute_time (&reserve->expiry),
|
||||||
TALER_PQ_query_param_amount (&reserve->balance),
|
TALER_PQ_query_param_amount (&reserve->balance),
|
||||||
GNUNET_PQ_query_param_auto_from_type (&reserve->pub),
|
GNUNET_PQ_query_param_auto_from_type (&reserve->pub),
|
||||||
GNUNET_PQ_query_param_end
|
GNUNET_PQ_query_param_end
|
||||||
};
|
};
|
||||||
|
|
||||||
result = GNUNET_PQ_exec_prepared (session->conn,
|
result = GNUNET_PQ_exec_prepared (session->conn,
|
||||||
"reserve_update",
|
"reserve_update",
|
||||||
params);
|
params);
|
||||||
if (PGRES_COMMAND_OK != PQresultStatus(result))
|
/* FIXME: properly distinguish between hard and soft (retry-able) failures here! */
|
||||||
|
if (PGRES_COMMAND_OK != PQresultStatus (result))
|
||||||
{
|
{
|
||||||
QUERY_ERR (result, session->conn);
|
QUERY_ERR (result,
|
||||||
|
session->conn);
|
||||||
ret = GNUNET_SYSERR;
|
ret = GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2236,9 +2238,10 @@ postgres_reserves_in_insert (void *cls,
|
|||||||
}
|
}
|
||||||
updated_reserve.expiry = GNUNET_TIME_absolute_max (expiry,
|
updated_reserve.expiry = GNUNET_TIME_absolute_max (expiry,
|
||||||
reserve.expiry);
|
reserve.expiry);
|
||||||
if (GNUNET_OK != reserves_update (cls,
|
if (GNUNET_OK !=
|
||||||
session,
|
reserves_update (cls,
|
||||||
&updated_reserve))
|
session,
|
||||||
|
&updated_reserve))
|
||||||
goto rollback;
|
goto rollback;
|
||||||
}
|
}
|
||||||
if (GNUNET_OK != postgres_commit (cls,
|
if (GNUNET_OK != postgres_commit (cls,
|
||||||
@ -2429,6 +2432,7 @@ postgres_insert_withdraw_info (void *cls,
|
|||||||
TALER_PQ_query_param_amount (&collectable->amount_with_fee),
|
TALER_PQ_query_param_amount (&collectable->amount_with_fee),
|
||||||
GNUNET_PQ_query_param_end
|
GNUNET_PQ_query_param_end
|
||||||
};
|
};
|
||||||
|
int ret;
|
||||||
|
|
||||||
now = GNUNET_TIME_absolute_get ();
|
now = GNUNET_TIME_absolute_get ();
|
||||||
GNUNET_CRYPTO_rsa_public_key_hash (collectable->denom_pub.rsa_public_key,
|
GNUNET_CRYPTO_rsa_public_key_hash (collectable->denom_pub.rsa_public_key,
|
||||||
@ -2471,14 +2475,15 @@ postgres_insert_withdraw_info (void *cls,
|
|||||||
pg->idle_reserve_expiration_time);
|
pg->idle_reserve_expiration_time);
|
||||||
reserve.expiry = GNUNET_TIME_absolute_max (expiry,
|
reserve.expiry = GNUNET_TIME_absolute_max (expiry,
|
||||||
reserve.expiry);
|
reserve.expiry);
|
||||||
if (GNUNET_OK != reserves_update (cls,
|
ret = reserves_update (cls,
|
||||||
session,
|
session,
|
||||||
&reserve))
|
&reserve);
|
||||||
|
if (GNUNET_SYSERR == ret)
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
return GNUNET_OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -5212,14 +5217,15 @@ postgres_insert_reserve_closed (void *cls,
|
|||||||
return GNUNET_NO;
|
return GNUNET_NO;
|
||||||
}
|
}
|
||||||
GNUNET_break (GNUNET_NO == ret);
|
GNUNET_break (GNUNET_NO == ret);
|
||||||
if (GNUNET_OK != reserves_update (cls,
|
ret = reserves_update (cls,
|
||||||
session,
|
session,
|
||||||
&reserve))
|
&reserve);
|
||||||
|
if (GNUNET_SYSERR == ret)
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
return GNUNET_OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -6456,14 +6462,15 @@ postgres_insert_payback_request (void *cls,
|
|||||||
pg->idle_reserve_expiration_time);
|
pg->idle_reserve_expiration_time);
|
||||||
reserve.expiry = GNUNET_TIME_absolute_max (expiry,
|
reserve.expiry = GNUNET_TIME_absolute_max (expiry,
|
||||||
reserve.expiry);
|
reserve.expiry);
|
||||||
if (GNUNET_OK != reserves_update (cls,
|
ret = reserves_update (cls,
|
||||||
session,
|
session,
|
||||||
&reserve))
|
&reserve);
|
||||||
|
if (GNUNET_SYSERR == ret)
|
||||||
{
|
{
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
return GNUNET_SYSERR;
|
return GNUNET_SYSERR;
|
||||||
}
|
}
|
||||||
return GNUNET_OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user