gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: fix #6133: enable nice shutdown


From: gnunet
Subject: [taler-exchange] branch master updated: fix #6133: enable nice shutdown of auditor helpers with CTRL-C
Date: Wed, 15 Jul 2020 21:22:48 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 8f0a4b60 fix #6133: enable nice shutdown of auditor helpers with CTRL-C
8f0a4b60 is described below

commit 8f0a4b6095fd05e101fc5389cc46ec211083979a
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Jul 15 21:22:44 2020 +0200

    fix #6133: enable nice shutdown of auditor helpers with CTRL-C
---
 src/auditor/taler-helper-auditor-aggregation.c |  4 +++
 src/auditor/taler-helper-auditor-coins.c       | 41 ++++++++++++++++++++++++--
 src/auditor/taler-helper-auditor-deposits.c    | 12 ++++++--
 src/auditor/taler-helper-auditor-reserves.c    | 14 ++++++++-
 src/auditor/taler-helper-auditor-wire.c        | 12 ++++++++
 src/auditordb/plugin_auditordb_postgres.c      |  8 +++--
 src/include/taler_auditordb_plugin.h           |  3 +-
 7 files changed, 83 insertions(+), 11 deletions(-)

diff --git a/src/auditor/taler-helper-auditor-aggregation.c 
b/src/auditor/taler-helper-auditor-aggregation.c
index 2a56971d..e3e840e8 100644
--- a/src/auditor/taler-helper-auditor-aggregation.c
+++ b/src/auditor/taler-helper-auditor-aggregation.c
@@ -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;
 }
 
diff --git a/src/auditor/taler-helper-auditor-coins.c 
b/src/auditor/taler-helper-auditor-coins.c
index 8b163fd0..067d6703 100644
--- a/src/auditor/taler-helper-auditor-coins.c
+++ b/src/auditor/taler-helper-auditor-coins.c
@@ -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;
 }
 
diff --git a/src/auditor/taler-helper-auditor-deposits.c 
b/src/auditor/taler-helper-auditor-deposits.c
index ed23c6a5..41cf406c 100644
--- a/src/auditor/taler-helper-auditor-deposits.c
+++ b/src/auditor/taler-helper-auditor-deposits.c
@@ -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;
 }
 
 
diff --git a/src/auditor/taler-helper-auditor-reserves.c 
b/src/auditor/taler-helper-auditor-reserves.c
index 0b140e74..d596863e 100644
--- a/src/auditor/taler-helper-auditor-reserves.c
+++ b/src/auditor/taler-helper-auditor-reserves.c
@@ -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;
 }
 
diff --git a/src/auditor/taler-helper-auditor-wire.c 
b/src/auditor/taler-helper-auditor-wire.c
index 247a7572..7eb3a047 100644
--- a/src/auditor/taler-helper-auditor-wire.c
+++ b/src/auditor/taler-helper-auditor-wire.c
@@ -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;
 }
 
diff --git a/src/auditordb/plugin_auditordb_postgres.c 
b/src/auditordb/plugin_auditordb_postgres.c
index 4f9101fd..e10df29d 100644
--- a/src/auditordb/plugin_auditordb_postgres.c
+++ b/src/auditordb/plugin_auditordb_postgres.c
@@ -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;
   }
 }
 
diff --git a/src/include/taler_auditordb_plugin.h 
b/src/include/taler_auditordb_plugin.h
index 7c58e654..33e1adec 100644
--- a/src/include/taler_auditordb_plugin.h
+++ b/src/include/taler_auditordb_plugin.h
@@ -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,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]