diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-06-23 14:37:53 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-06-23 14:37:53 +0200 |
commit | 6acb0271d6413b250cf78b42aed52a9cb0d0869c (patch) | |
tree | bad5474df053edbbe6ad877468365f6387ab9c73 /src/exchange | |
parent | ff8633910d90d7c5299016bce7a8ea49e12510a7 (diff) | |
download | exchange-6acb0271d6413b250cf78b42aed52a9cb0d0869c.tar.gz exchange-6acb0271d6413b250cf78b42aed52a9cb0d0869c.tar.bz2 exchange-6acb0271d6413b250cf78b42aed52a9cb0d0869c.zip |
address #5010 for wirewatch
Diffstat (limited to 'src/exchange')
-rw-r--r-- | src/exchange/taler-exchange-wirewatch.c | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/src/exchange/taler-exchange-wirewatch.c b/src/exchange/taler-exchange-wirewatch.c index f019f9bcc..312f8ac5e 100644 --- a/src/exchange/taler-exchange-wirewatch.c +++ b/src/exchange/taler-exchange-wirewatch.c @@ -223,7 +223,7 @@ history_cb (void *cls, const struct TALER_WIRE_TransferDetails *details) { struct TALER_EXCHANGEDB_Session *session = cls; - int ret; + enum GNUNET_DB_QueryStatus qs; if (TALER_BANK_DIRECTION_NONE == dir) { @@ -231,9 +231,9 @@ history_cb (void *cls, GNUNET_log (GNUNET_ERROR_TYPE_INFO, "End of list. Committing progress!\n"); - ret = db_plugin->commit (db_plugin->cls, - session); - if (GNUNET_OK == ret) + qs = db_plugin->commit (db_plugin->cls, + session); + if (0 <= qs) { GNUNET_free_non_null (start_off); start_off = last_row_off; @@ -258,18 +258,25 @@ history_cb (void *cls, "Adding wire transfer over %s with subject `%s'\n", TALER_amount2s (&details->amount), TALER_B2S (&details->reserve_pub)); - ret = db_plugin->reserves_in_insert (db_plugin->cls, - session, - &details->reserve_pub, - &details->amount, - details->execution_date, - details->account_details, - row_off, - row_off_size); - if (GNUNET_OK != ret) + qs = db_plugin->reserves_in_insert (db_plugin->cls, + session, + &details->reserve_pub, + &details->amount, + details->execution_date, + details->account_details, + row_off, + row_off_size); + if (GNUNET_DB_STATUS_HARD_ERROR == qs) { GNUNET_break (0); db_plugin->rollback (db_plugin->cls, + session); + GNUNET_SCHEDULER_shutdown (); + return GNUNET_SYSERR; + } + if (GNUNET_DB_STATUS_SOFT_ERROR == qs) + { + db_plugin->rollback (db_plugin->cls, session); /* try again */ task = GNUNET_SCHEDULER_add_now (&find_transfers, @@ -298,7 +305,7 @@ static void find_transfers (void *cls) { struct TALER_EXCHANGEDB_Session *session; - int ret; + enum GNUNET_DB_QueryStatus qs; task = NULL; GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -322,11 +329,11 @@ find_transfers (void *cls) GNUNET_SCHEDULER_shutdown (); return; } - ret = db_plugin->get_latest_reserve_in_reference (db_plugin->cls, - session, - &start_off, - &start_off_size); - if (GNUNET_SYSERR == ret) + qs = db_plugin->get_latest_reserve_in_reference (db_plugin->cls, + session, + &start_off, + &start_off_size); + if (GNUNET_DB_STATUS_HARD_ERROR == qs) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to obtain starting point for montoring from database!\n"); @@ -334,6 +341,15 @@ find_transfers (void *cls) GNUNET_SCHEDULER_shutdown (); return; } + if (GNUNET_DB_STATUS_SOFT_ERROR == qs) + { + /* try again */ + db_plugin->rollback (db_plugin->cls, + session); + task = GNUNET_SCHEDULER_add_now (&find_transfers, + NULL); + return; + } delay = GNUNET_YES; hh = wire_plugin->get_history (wire_plugin->cls, TALER_BANK_DIRECTION_CREDIT, |