gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] 01/05: changed shutdown routine


From: gnunet
Subject: [taler-anastasis] 01/05: changed shutdown routine
Date: Tue, 07 Apr 2020 01:02:13 +0200

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

dennis-neufeld pushed a commit to branch master
in repository anastasis.

commit b1516d6a92d9bfcb97286d1115a9b23ec7325ec4
Author: Dennis Neufeld <address@hidden>
AuthorDate: Mon Apr 6 16:53:44 2020 +0000

    changed shutdown routine
---
 src/backend/anastasis-httpd.c               | 11 ++++++-----
 src/backend/anastasis-httpd_policy.h        |  8 ++++++++
 src/backend/anastasis-httpd_policy_upload.c | 28 ++++++++++++++++++++++++++++
 3 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/src/backend/anastasis-httpd.c b/src/backend/anastasis-httpd.c
index 2de7f26..dbb5d86 100644
--- a/src/backend/anastasis-httpd.c
+++ b/src/backend/anastasis-httpd.c
@@ -365,6 +365,12 @@ static void
 do_shutdown (void *cls)
 {
   (void) cls;
+  AH_resume_all_bc ();
+  if (NULL != mhd_task)
+  {
+    GNUNET_SCHEDULER_cancel (mhd_task);
+    mhd_task = NULL;
+  }
   if (NULL != AH_ctx)
   {
     GNUNET_CURL_fini (AH_ctx);
@@ -375,11 +381,6 @@ do_shutdown (void *cls)
     GNUNET_CURL_gnunet_rc_destroy (rc);
     rc = NULL;
   }
-  if (NULL != mhd_task)
-  {
-    GNUNET_SCHEDULER_cancel (mhd_task);
-    mhd_task = NULL;
-  }
   if (NULL != mhd)
   {
     MHD_stop_daemon (mhd);
diff --git a/src/backend/anastasis-httpd_policy.h 
b/src/backend/anastasis-httpd_policy.h
index d05d46a..5e9cab1 100644
--- a/src/backend/anastasis-httpd_policy.h
+++ b/src/backend/anastasis-httpd_policy.h
@@ -24,6 +24,14 @@
 #define ANASTASIS_HTTPD_POLICY_H
 #include <microhttpd.h>
 
+
+/**
+ * Service is shutting down, resume all MHD connections NOW.
+ */
+void
+AH_resume_all_bc (void);
+
+
 /**
  * @param connection the MHD connection to handle
  * @param url handles a URL of the format 
"/policy/$ACCOUNT_PUB[&version=$NUMBER]"
diff --git a/src/backend/anastasis-httpd_policy_upload.c 
b/src/backend/anastasis-httpd_policy_upload.c
index 93cfc02..8a3fe75 100644
--- a/src/backend/anastasis-httpd_policy_upload.c
+++ b/src/backend/anastasis-httpd_policy_upload.c
@@ -160,6 +160,34 @@ static struct PolicyUploadContext *puc_head;
 static struct PolicyUploadContext *puc_tail;
 
 
+/**
+ * Service is shutting down, resume all MHD connections NOW.
+ */
+void
+AH_resume_all_bc ()
+{
+  struct PolicyUploadContext *puc;
+
+  while (NULL != (puc = puc_head))
+  {
+    GNUNET_CONTAINER_DLL_remove (puc_head,
+                                 puc_tail,
+                                 puc);
+    MHD_resume_connection (puc->con);
+    if (NULL != puc->po)
+    {
+      TALER_MERCHANT_proposal_cancel (puc->po);
+      puc->po = NULL;
+    }
+    if (NULL != puc->cpo)
+    {
+      TALER_MERCHANT_check_payment_cancel (puc->cpo);
+      puc->cpo = NULL;
+    }
+  }
+}
+
+
 /**
  * Function called to clean up a backup context.
  *

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



reply via email to

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