aboutsummaryrefslogtreecommitdiff
path: root/src/util/crypto_helper_denom.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-12-12 11:34:57 +0100
committerChristian Grothoff <christian@grothoff.org>2020-12-12 11:34:57 +0100
commit09abf5e7e08c749c0a8904ba651e0357404e8aa9 (patch)
tree12cd3c8779a80f59d25e4a4f7f0e8158238938c2 /src/util/crypto_helper_denom.c
parent2a3de6555abde9a7159187e01ee140192b155f25 (diff)
integrate new REST calls, add timeout to helper invocations
Diffstat (limited to 'src/util/crypto_helper_denom.c')
-rw-r--r--src/util/crypto_helper_denom.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/util/crypto_helper_denom.c b/src/util/crypto_helper_denom.c
index fa8a820b5..81a4e8fd7 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),