diff options
Diffstat (limited to 'src/util/crypto_helper_esign.c')
-rw-r--r-- | src/util/crypto_helper_esign.c | 29 |
1 files changed, 29 insertions, 0 deletions
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), |