aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/crypto_helper_denom.c30
-rw-r--r--src/util/crypto_helper_esign.c29
2 files changed, 59 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),
diff --git a/src/util/crypto_helper_esign.c b/src/util/crypto_helper_esign.c
index fde7f48ee..39130e04f 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),