gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libebics] branch master updated: Fix assert failure due to


From: gnunet
Subject: [GNUnet-SVN] [libebics] branch master updated: Fix assert failure due to pending job.
Date: Mon, 22 Oct 2018 17:39:37 +0200

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

marcello pushed a commit to branch master
in repository libebics.

The following commit(s) were added to refs/heads/master by this push:
     new e37ac61  Fix assert failure due to pending job.
e37ac61 is described below

commit e37ac614f6eeea8c4d08b20abec6992997a59035
Author: Marcello Stanisci <address@hidden>
AuthorDate: Mon Oct 22 17:38:59 2018 +0200

    Fix assert failure due to pending job.
    
    Put the job closing logic into the library.
---
 src/libebics.c      | 24 ++++++++++++++++++------
 src/libebics.h      |  2 +-
 src/sandbox_tests.c | 12 +++---------
 3 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/src/libebics.c b/src/libebics.c
index 2a4c2e2..64a3077 100644
--- a/src/libebics.c
+++ b/src/libebics.c
@@ -46,6 +46,11 @@
 static struct GNUNET_CURL_Context *ctx;
 
 /**
+ * Current HTTP job
+ */
+static struct GNUNET_CURL_Job *job = NULL;
+
+/**
  * Reschedule context for GNUnet CURL
  */
 static struct GNUNET_CURL_RescheduleContext *reschedule_ctx;
@@ -645,6 +650,7 @@ parse_response (struct GNUNET_CURL_DownloadBuffer *db,
   xmlParserCtxtPtr parser;
   xmlDocPtr doc = NULL;
   http_status = 0;
+  job = NULL;
 
   if (0 == db->eno)
   {
@@ -810,6 +816,13 @@ EBICS_close_library ()
 
   if (NULL != reschedule_ctx)
     GNUNET_CURL_gnunet_rc_destroy (reschedule_ctx);
+
+  if (NULL != job)
+  {
+    GNUNET_CURL_job_cancel (job);
+    job = NULL;
+  }
+
   if (NULL != ctx)
     GNUNET_CURL_fini (ctx);
 
@@ -1037,9 +1050,9 @@ process_response (void *cls,
  *        copied by libcurl.
  * @param URL url of the EBICS endpoint
  * @param cb callback to pass the response data
- * @return the CURL job, or NULL upon errors.
+ * @return EBICS_ERROR | EBICS_SUCCESS.
  */
-struct GNUNET_CURL_Job *
+int
 EBICS_send_message (const struct EBICS_genex_document *document,
                     const char *url,
                     EBICS_ResponseCallback cb)
@@ -1048,7 +1061,6 @@ EBICS_send_message (const struct EBICS_genex_document 
*document,
   int size;
   xmlChar *buf;
   CURL *eh;
-  struct GNUNET_CURL_Job *job;
 
 #define SETOPT(eh,opt,par) \
   if (CURLE_OK != curl_easy_setopt (eh, opt, par)) \
@@ -1058,7 +1070,7 @@ EBICS_send_message (const struct EBICS_genex_document 
*document,
          __FILE__, \
          __LINE__); \
     curl_easy_cleanup (eh); \
-    return NULL; \
+    return EBICS_ERROR; \
   }
 
   xmlDocDumpFormatMemoryEnc (document->document,
@@ -1096,8 +1108,8 @@ EBICS_send_message (const struct EBICS_genex_document 
*document,
     LOG (EBICS_LOGLEVEL_ERROR,
          "Could not submit the CURL job\n");
     curl_easy_cleanup (eh);
-    return NULL;
+    return EBICS_ERROR;
   }
 
-  return job;
+  return EBICS_SUCCESS;
 }
diff --git a/src/libebics.h b/src/libebics.h
index 83047ad..06370f9 100644
--- a/src/libebics.h
+++ b/src/libebics.h
@@ -168,7 +168,7 @@ typedef void
  * @param cb callback to pass the response data
  * @return EBICS_SUCCESS / EBICS_ERROR
  */
-struct GNUNET_CURL_Job *
+int
 EBICS_send_message (const struct EBICS_genex_document *document,
                     const char *url,
                     EBICS_ResponseCallback cb);
diff --git a/src/sandbox_tests.c b/src/sandbox_tests.c
index db3a3c4..efd77aa 100644
--- a/src/sandbox_tests.c
+++ b/src/sandbox_tests.c
@@ -44,12 +44,6 @@
 int result = EBICS_ERROR;
 
 /**
- * Current CURL job
- */
-struct GNUNET_CURL_Job *job;
-
-
-/**
  * Process responses from banks.
  *
  * @param response_code HTTP response given by
@@ -135,9 +129,9 @@ run ()
     return;
   }
 
-  if (NULL == (job = EBICS_send_message (msg,
-                                         BANK_URL,
-                                         cb)))
+  if (EBICS_SUCCESS != EBICS_send_message (msg,
+                                           BANK_URL,
+                                           cb))
   {
     LOG (EBICS_LOGLEVEL_ERROR,
          "Could not POST the INI message\n");

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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