taler-mdb

GNU Taler Extensions and Integrations
Log | Files | Refs | Submodules | README | LICENSE

commit 77d411d5eaf525dca9b2686ac9252c6e8b626324
parent 8af8ea322434f5835000adb29c57de8aa3b607aa
Author: Christian Grothoff <grothoff@gnunet.org>
Date:   Tue, 23 Jan 2024 10:06:03 +0100

fix adv overwrites err bug

Diffstat:
Mcontrib/taler-mdb-ads.sh | 2+-
Msrc/taler-mdb.c | 66++++++++++++++++++++++++++++++++++--------------------------------
2 files changed, 35 insertions(+), 33 deletions(-)

diff --git a/contrib/taler-mdb-ads.sh b/contrib/taler-mdb-ads.sh @@ -39,7 +39,7 @@ DATA_HOME=$(taler-config -c "$CONF" -s paths -o DATADIR -f) while true do - HOUR=$(date +%H) + HOUR=$(date +%H | sed -e "/^0//") if [[ HOUR -ge 8 && HOUR -lt 22 ]] then taler-mdb-display -c "$CONF" diff --git a/src/taler-mdb.c b/src/taler-mdb.c @@ -895,6 +895,38 @@ start_command (const char *command, /** + * Stop the advertising process. + */ +static void +stop_advertising (void) +{ + if (NULL == adv_child) + return; + GNUNET_break (0 == + GNUNET_OS_process_kill (adv_child, + SIGTERM)); + GNUNET_break (GNUNET_OK == + GNUNET_OS_process_wait (adv_child)); + GNUNET_OS_process_destroy (adv_child); + adv_child = NULL; +} + + +/** + * Start the advertising process. + */ +static void +start_advertising (void) +{ + stop_advertising (); /* just to be sure */ + if (NULL == adv_process_command) + return; + adv_child = start_command (adv_process_command, + NULL); +} + + +/** * Stop the process showing an error. */ static void @@ -914,6 +946,7 @@ hide_error (void) GNUNET_OS_process_wait (err_child)); GNUNET_OS_process_destroy (err_child); err_child = NULL; + start_advertising (); } @@ -926,6 +959,7 @@ hide_error (void) static void show_error (const char *err_type) { + stop_advertising (); hide_error (); /* just to be sure */ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Showing error `%s'\n", @@ -968,38 +1002,6 @@ temporary_error (const char *err_type) } -/** - * Stop the advertising process. - */ -static void -stop_advertising (void) -{ - if (NULL == adv_child) - return; - GNUNET_break (0 == - GNUNET_OS_process_kill (adv_child, - SIGTERM)); - GNUNET_break (GNUNET_OK == - GNUNET_OS_process_wait (adv_child)); - GNUNET_OS_process_destroy (adv_child); - adv_child = NULL; -} - - -/** - * Start the advertising process. - */ -static void -start_advertising (void) -{ - stop_advertising (); /* just to be sure */ - if (NULL == adv_process_command) - return; - adv_child = start_command (adv_process_command, - NULL); -} - - #if HAVE_QRENCODE_H #include <qrencode.h>