[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-exchange] branch master updated: integrate new REST calls, add ti
From: |
gnunet |
Subject: |
[taler-exchange] branch master updated: integrate new REST calls, add timeout to helper invocations |
Date: |
Sat, 12 Dec 2020 11:35:00 +0100 |
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 09abf5e7 integrate new REST calls, add timeout to helper invocations
09abf5e7 is described below
commit 09abf5e7e08c749c0a8904ba651e0357404e8aa9
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sat Dec 12 11:34:57 2020 +0100
integrate new REST calls, add timeout to helper invocations
---
src/exchange/taler-exchange-httpd.c | 5 +----
src/exchange/taler-exchange-httpd_keys.c | 2 +-
src/util/crypto_helper_denom.c | 30 ++++++++++++++++++++++++++++++
src/util/crypto_helper_esign.c | 29 +++++++++++++++++++++++++++++
4 files changed, 61 insertions(+), 5 deletions(-)
diff --git a/src/exchange/taler-exchange-httpd.c
b/src/exchange/taler-exchange-httpd.c
index 0eb4de59..d9c56540 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -606,8 +606,6 @@ handle_post_management (const struct TEH_RequestHandler *rh,
&exchange_pub,
root);
}
-#if FIXME
- /* not yet implemented! */
if (0 == strcmp (args[0],
"keys"))
{
@@ -619,7 +617,6 @@ handle_post_management (const struct TEH_RequestHandler *rh,
return TEH_handler_management_post_keys (connection,
root);
}
-#endif
if (0 == strcmp (args[0],
"wire"))
{
@@ -808,7 +805,7 @@ handle_mhd_request (void *cls,
{
.url = "keys",
.method = MHD_HTTP_METHOD_GET,
- .handler.get = &TEH_handler_keys,
+ .handler.get = &TEH_handler_keys, // FIXME => TEH_keys_get_handler
},
/* Requests for wiring information */
{
diff --git a/src/exchange/taler-exchange-httpd_keys.c
b/src/exchange/taler-exchange-httpd_keys.c
index 88ab2e30..6e778677 100644
--- a/src/exchange/taler-exchange-httpd_keys.c
+++ b/src/exchange/taler-exchange-httpd_keys.c
@@ -1700,7 +1700,7 @@ krd_search_comparator (const void *key,
MHD_RESULT
-TEH_handler_keys_NEW (const struct TEH_RequestHandler *rh,
+TEH_keys_get_handler (const struct TEH_RequestHandler *rh,
struct MHD_Connection *connection,
const char *const args[])
{
diff --git a/src/util/crypto_helper_denom.c b/src/util/crypto_helper_denom.c
index fa8a820b..81a4e8fd 100644
--- a/src/util/crypto_helper_denom.c
+++ b/src/util/crypto_helper_denom.c
@@ -22,6 +22,7 @@
#include "taler_util.h"
#include "taler_signatures.h"
#include "taler-helper-crypto-rsa.h"
+#include <poll.h>
struct TALER_CRYPTO_DenominationHelper
@@ -465,6 +466,35 @@ TALER_CRYPTO_helper_denom_sign (
const struct GNUNET_MessageHeader *hdr
= (const struct GNUNET_MessageHeader *) buf;
+ {
+ /* wait for reply with 5s timeout */
+ struct pollfd pfd = {
+ .fd = dh->sock,
+ .events = POLLIN
+ };
+ sigset_t sigmask;
+ struct timespec ts = {
+ .tv_sec = 5
+ };
+
+ GNUNET_assert (0 == sigemptyset (&sigmask));
+ GNUNET_assert (0 == sigaddset (&sigmask, SIGTERM));
+ GNUNET_assert (0 == sigaddset (&sigmask, SIGHUP));
+ ret = ppoll (&pfd,
+ 1,
+ &ts,
+ &sigmask);
+ if ( (-1 == ret) &&
+ (EINTR != errno) )
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
+ "ppoll");
+ if (0 >= ret)
+ {
+ do_disconnect (dh);
+ *ec = TALER_EC_GENERIC_TIMEOUT;
+ return ds;
+ }
+ }
ret = recv (dh->sock,
buf,
sizeof (buf),
diff --git a/src/util/crypto_helper_esign.c b/src/util/crypto_helper_esign.c
index fde7f48e..39130e04 100644
--- a/src/util/crypto_helper_esign.c
+++ b/src/util/crypto_helper_esign.c
@@ -22,6 +22,7 @@
#include "taler_util.h"
#include "taler_signatures.h"
#include "taler-helper-crypto-eddsa.h"
+#include <poll.h>
struct TALER_CRYPTO_ExchangeSignHelper
@@ -421,6 +422,34 @@ TALER_CRYPTO_helper_esign_sign_ (
const struct GNUNET_MessageHeader *hdr
= (const struct GNUNET_MessageHeader *) buf;
+ {
+ /* wait for reply with 5s timeout */
+ struct pollfd pfd = {
+ .fd = esh->sock,
+ .events = POLLIN
+ };
+ sigset_t sigmask;
+ struct timespec ts = {
+ .tv_sec = 5
+ };
+
+ GNUNET_assert (0 == sigemptyset (&sigmask));
+ GNUNET_assert (0 == sigaddset (&sigmask, SIGTERM));
+ GNUNET_assert (0 == sigaddset (&sigmask, SIGHUP));
+ ret = ppoll (&pfd,
+ 1,
+ &ts,
+ &sigmask);
+ if ( (-1 == ret) &&
+ (EINTR != errno) )
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
+ "ppoll");
+ if (0 >= ret)
+ {
+ do_disconnect (esh);
+ return TALER_EC_GENERIC_TIMEOUT;
+ }
+ }
ret = recv (esh->sock,
buf,
sizeof (buf),
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-exchange] branch master updated: integrate new REST calls, add timeout to helper invocations,
gnunet <=