fix #6133: enable nice shutdown of auditor helpers with CTRL-C

This commit is contained in:
Christian Grothoff 2020-07-15 21:22:44 +02:00
parent 6cabb25d8d
commit 8f0a4b6095
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
7 changed files with 83 additions and 11 deletions

View File

@ -1176,11 +1176,15 @@ check_wire_out_cb (void *cls,
TALER_JSON_from_amount (&final_amount),
"claimed",
TALER_JSON_from_amount (amount)));
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Aggregation unit %s is OK\n",
TALER_B2S (wtid));
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}

View File

@ -991,6 +991,8 @@ withdraw_cb (void *cls,
report_row_inconsistency ("withdraw",
rowid,
"denomination key not found");
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
@ -1032,6 +1034,8 @@ withdraw_cb (void *cls,
TALER_ARL_amount_add (&ds->denom_risk,
&ds->denom_risk,
&value);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
@ -1252,6 +1256,8 @@ refresh_session_cb (void *cls,
report_row_inconsistency ("melt",
rowid,
"denomination key not found");
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
@ -1346,6 +1352,8 @@ refresh_session_cb (void *cls,
TALER_ARL_amount_add (&total_refresh_hanging,
&total_refresh_hanging,
amount_with_fee);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
if (GNUNET_SYSERR == reveal_ctx.err)
@ -1354,7 +1362,11 @@ refresh_session_cb (void *cls,
if (GNUNET_OK != reveal_ctx.err)
{
GNUNET_free (reveal_ctx.new_issues);
return (GNUNET_SYSERR == reveal_ctx.err) ? GNUNET_SYSERR : GNUNET_OK;
if (GNUNET_SYSERR == reveal_ctx.err)
return GNUNET_SYSERR;
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
/* Check that the resulting amounts are consistent with the value being
@ -1527,6 +1539,8 @@ refresh_session_cb (void *cls,
&total_melt_fee_income,
&rfee);
}
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
@ -1586,6 +1600,8 @@ deposit_cb (void *cls,
report_row_inconsistency ("deposits",
rowid,
"denomination key not found");
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
if (refund_deadline.abs_value_us >
@ -1645,6 +1661,8 @@ deposit_cb (void *cls,
TALER_ARL_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
amount_with_fee);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
TALER_amount_hton (&dr.amount_with_fee,
@ -1669,6 +1687,8 @@ deposit_cb (void *cls,
TALER_ARL_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
amount_with_fee);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
}
@ -1746,7 +1766,8 @@ deposit_cb (void *cls,
&total_deposit_fee_income,
&dfee);
}
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
@ -1797,7 +1818,9 @@ refund_cb (void *cls,
report_row_inconsistency ("refunds",
rowid,
"denomination key not found");
return GNUNET_SYSERR;
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
{
@ -1835,6 +1858,8 @@ refund_cb (void *cls,
TALER_ARL_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
amount_with_fee);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
}
@ -1851,6 +1876,8 @@ refund_cb (void *cls,
&amount_without_fee,
&refund_fee,
-1);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
@ -1893,6 +1920,8 @@ refund_cb (void *cls,
TALER_ARL_amount_add (&total_refund_fee_income,
&total_refund_fee_income,
&refund_fee);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
@ -1947,6 +1976,8 @@ check_recoup (struct CoinContext *cc,
report_row_inconsistency (operation,
rowid,
"denomination key not found");
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs)
@ -1994,6 +2025,8 @@ check_recoup (struct CoinContext *cc,
TALER_ARL_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
amount);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
}
@ -2032,6 +2065,8 @@ check_recoup (struct CoinContext *cc,
&total_recoup_loss,
amount);
}
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}

View File

@ -96,8 +96,9 @@ struct DepositConfirmationContext
* @param cls our `struct DepositConfirmationContext`
* @param serial_id row of the @a dc in the database
* @param dc the deposit confirmation we know
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERROR to stop iterating
*/
static void
static int
test_dc (void *cls,
uint64_t serial_id,
const struct TALER_AUDITORDB_DepositConfirmation *dc)
@ -128,13 +129,15 @@ test_dc (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Found deposit %s in exchange database\n",
GNUNET_h2s (&dc->h_contract_terms));
return; /* found, all good */
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK; /* found, all good */
}
if (qs < 0)
{
GNUNET_break (0); /* DB error, complain */
dcc->qs = qs;
return;
return GNUNET_SYSERR;
}
}
/* deposit confirmation missing! report! */
@ -155,6 +158,9 @@ test_dc (void *cls,
TALER_ARL_amount_add (&dcc->missed_amount,
&dcc->missed_amount,
&dc->amount_without_fee);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}

View File

@ -456,6 +456,8 @@ handle_reserve_in (void *cls,
idle_reserve_expiration_time);
rs->a_expiration_date = GNUNET_TIME_absolute_max (rs->a_expiration_date,
expiry);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
@ -524,6 +526,8 @@ handle_reserve_out (void *cls,
report_row_inconsistency ("withdraw",
rowid,
"denomination key not found");
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
@ -569,7 +573,9 @@ handle_reserve_out (void *cls,
TALER_ARL_amount_add (&total_bad_sig_loss,
&total_bad_sig_loss,
amount_with_fee);
return GNUNET_OK; /* exit here, we cannot add this to the legitimate withdrawals */
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK; /* exit function here, we cannot add this to the legitimate withdrawals */
}
GNUNET_CRYPTO_hash (reserve_pub,
@ -620,6 +626,8 @@ handle_reserve_out (void *cls,
TALER_ARL_amount_add (&rs->total_fee,
&rs->total_fee,
&withdraw_fee);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
@ -813,6 +821,8 @@ handle_recoup_by_reserve (
idle_reserve_expiration_time);
rs->a_expiration_date = GNUNET_TIME_absolute_max (rs->a_expiration_date,
expiry);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
@ -980,6 +990,8 @@ handle_reserve_closed (
"Additional closing operation for reserve `%s' of %s\n",
TALER_B2S (reserve_pub),
TALER_amount2s (amount_with_fee));
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}

View File

@ -1002,6 +1002,8 @@ wire_out_cb (void *cls,
TALER_ARL_amount_add (&total_bad_amount_out_minus,
&total_bad_amount_out_minus,
amount);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
{
@ -1102,6 +1104,8 @@ cleanup:
&key,
roi));
wa->pp.last_wire_out_serial_id = rowid + 1;
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
@ -1491,9 +1495,13 @@ reserve_in_cb (void *cls,
&rii->row_off_hash),
"diagnostic", "duplicate wire offset"));
GNUNET_free (rii);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
wa->pp.last_reserve_in_serial_id = rowid + 1;
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
@ -1866,6 +1874,8 @@ reserve_closed_cb (void *cls,
"diagnostic",
"closing fee above total amount"));
GNUNET_free (rc);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}
pp.last_reserve_close_uuid
@ -1882,6 +1892,8 @@ reserve_closed_cb (void *cls,
&key,
rc,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
if (TALER_ARL_do_abort ())
return GNUNET_SYSERR;
return GNUNET_OK;
}

View File

@ -1236,9 +1236,11 @@ deposit_confirmation_cb (void *cls,
return;
}
dcc->qs = i + 1;
dcc->cb (dcc->cb_cls,
serial_id,
&dc);
if (GNUNET_OK !=
dcc->cb (dcc->cb_cls,
serial_id,
&dc))
break;
}
}

View File

@ -364,8 +364,9 @@ struct TALER_AUDITORDB_DepositConfirmation
* @param cls closure
* @param serial_id location of the @a dc in the database
* @param dc the deposit confirmation itself
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERROR to stop iterating
*/
typedef void
typedef int
(*TALER_AUDITORDB_DepositConfirmationCallback)(
void *cls,
uint64_t serial_id,