gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: crash fixes


From: gnunet
Subject: [taler-anastasis] branch master updated: crash fixes
Date: Wed, 14 Oct 2020 16:31:20 +0200

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

grothoff pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new 7c9704a  crash fixes
7c9704a is described below

commit 7c9704a2bc742254df92fa1e34461486a2b5c3b7
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Oct 14 16:31:18 2020 +0200

    crash fixes
---
 src/cli/Makefile.am            |  2 ++
 src/cli/anastasis-cli-redux.c  | 18 ++++++++++++------
 src/lib/anastasis_api_config.c |  2 +-
 src/lib/anastasis_api_redux.c  | 10 ++++++----
 4 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/src/cli/Makefile.am b/src/cli/Makefile.am
index a6f4409..b401a11 100644
--- a/src/cli/Makefile.am
+++ b/src/cli/Makefile.am
@@ -48,7 +48,9 @@ anastasis_assembler_LDADD = \
 anastasis_reducer_SOURCES = \
   anastasis-cli-redux.c
 anastasis_reducer_LDADD = \
+  $(top_builddir)/src/util/libanastasisutil.la \
   $(top_builddir)/src/lib/libanastasisredux.la \
+  -ltalerutil \
   -lgnunetjson \
   -lgnunetcurl \
   -lgnunetutil \
diff --git a/src/cli/anastasis-cli-redux.c b/src/cli/anastasis-cli-redux.c
index 9b2c4d3..869936f 100644
--- a/src/cli/anastasis-cli-redux.c
+++ b/src/cli/anastasis-cli-redux.c
@@ -25,7 +25,8 @@
 #include <gnunet/gnunet_util_lib.h>
 #include <gnunet/gnunet_curl_lib.h>
 #include "anastasis_redux.h"
-
+#include <taler/taler_util.h>
+#include "anastasis_util_lib.h"
 
 /**
  * Closure for #GNUNET_CURL_gnunet_scheduler_reschedule().
@@ -100,10 +101,9 @@ action_cb (void *cls,
 {
   new_state = result_state;
   if (NULL != new_state)
-    if (0 == persist_new_state ())
-      return;
-  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-              "Failed to persist new state! \n");
+    if (0 != persist_new_state ())
+      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                  "Failed to persist new state! \n");
   GNUNET_SCHEDULER_shutdown ();
 }
 
@@ -117,9 +117,9 @@ static void
 shutdown_task (void *cls)
 {
   (void) cls;
+
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Shutdown initiated\n");
-
   // FIXME shutdown routine here
   if (NULL != rc)
   {
@@ -200,6 +200,7 @@ run (void *cls,
         GNUNET_SCHEDULER_shutdown ();
         return;
       }
+      return; // success!
     }
     else
     {
@@ -296,6 +297,11 @@ main (int argc,
     GNUNET_GETOPT_OPTION_END
   };
 
+  /* FIRST get the libtalerutil initialization out
+     of the way. Then throw that one away, and force
+     the SYNC defaults to be used! */
+  (void) TALER_project_data_default ();
+  GNUNET_OS_init (ANASTASIS_project_data_default ());
   ret = GNUNET_PROGRAM_run (argc,
                             argv,
                             "anastasis-reducer",
diff --git a/src/lib/anastasis_api_config.c b/src/lib/anastasis_api_config.c
index e1834bf..dcc4fb9 100644
--- a/src/lib/anastasis_api_config.c
+++ b/src/lib/anastasis_api_config.c
@@ -101,7 +101,7 @@ handle_config_finished (void *cls,
   case 0:
     /* Hard error */
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Backend didn't even return from GET /config\n");
+                "Backend failed to respond to GET /config\n");
     break;
   case MHD_HTTP_OK:
     {
diff --git a/src/lib/anastasis_api_redux.c b/src/lib/anastasis_api_redux.c
index 46f685f..dc0358a 100644
--- a/src/lib/anastasis_api_redux.c
+++ b/src/lib/anastasis_api_redux.c
@@ -275,8 +275,9 @@ conclude_select_country (struct SelectCountryHandle *sch)
     GNUNET_CONTAINER_DLL_remove (sch->cr_head,
                                  sch->cr_tail,
                                  cr);
-    if (0 != strcmp (cr->backend_currency,
-                     currency))
+    if ( (MHD_HTTP_OK != cr->http_status) ||
+         (0 != strcmp (cr->backend_currency,
+                       currency)) )
     {
       free_config_request (cr);
       continue;
@@ -590,7 +591,7 @@ select_country (json_t *state,
     sch = GNUNET_new (struct SelectCountryHandle);
     sch->cb = cb;
     sch->cb_cls = cb_cls;
-    sch->state = state;
+    sch->state = json_incref (state);
     json_array_foreach (provider_arr, index, provider)
     {
       struct ConfigRequest *cr = GNUNET_new (struct ConfigRequest);
@@ -610,7 +611,7 @@ select_country (json_t *state,
       GNUNET_CONTAINER_DLL_insert (sch->cr_head,
                                    sch->cr_tail,
                                    cr);
-      cr->co = ANASTASIS_get_config (curl_ctx,
+      cr->co = ANASTASIS_get_config (curl_ctx, // FIXME: pass as argument!
                                      cr->backend_url,
                                      &config_cb,
                                      cr);
@@ -840,6 +841,7 @@ ANASTASIS_redux_action (const json_t *state,
                                                       "backup_state"));
   enum ANASTASIS_GenericState gs;
 
+  curl_ctx = ctx; // FIXME: pass as argument instead of as global
   if (NULL == s)
   {
     s = json_string_value (json_object_get (state,

-- 
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]