-proper fix for endless loop on IPC permission trouble
This commit is contained in:
parent
289b816e1c
commit
bd7e44720b
@ -434,6 +434,7 @@ TALER_CRYPTO_helper_denom_poll (struct TALER_CRYPTO_DenominationHelper *dh)
|
|||||||
{
|
{
|
||||||
char buf[UINT16_MAX];
|
char buf[UINT16_MAX];
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
unsigned int retry_limit = 10;
|
||||||
const struct GNUNET_MessageHeader *hdr
|
const struct GNUNET_MessageHeader *hdr
|
||||||
= (const struct GNUNET_MessageHeader *) buf;
|
= (const struct GNUNET_MessageHeader *) buf;
|
||||||
int flag = MSG_DONTWAIT;
|
int flag = MSG_DONTWAIT;
|
||||||
@ -462,11 +463,18 @@ TALER_CRYPTO_helper_denom_poll (struct TALER_CRYPTO_DenominationHelper *dh)
|
|||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Restarting connection to RSA helper, did not come up properly\n");
|
"Restarting connection to RSA helper, did not come up properly\n");
|
||||||
do_disconnect (dh);
|
do_disconnect (dh);
|
||||||
|
if (0 == retry_limit)
|
||||||
|
return; /* give up */
|
||||||
try_connect (dh);
|
try_connect (dh);
|
||||||
if (-1 == dh->sock)
|
if (-1 == dh->sock)
|
||||||
return; /* give up */
|
return; /* give up */
|
||||||
|
retry_limit--;
|
||||||
|
flag = MSG_DONTWAIT;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
flag = 0; /* syscall must be non-blocking this time */
|
flag = 0; /* syscall must be non-blocking this time */
|
||||||
|
}
|
||||||
continue; /* try again */
|
continue; /* try again */
|
||||||
}
|
}
|
||||||
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
|
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
|
||||||
@ -474,7 +482,7 @@ TALER_CRYPTO_helper_denom_poll (struct TALER_CRYPTO_DenominationHelper *dh)
|
|||||||
do_disconnect (dh);
|
do_disconnect (dh);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
retry_limit = 10;
|
||||||
flag = MSG_DONTWAIT;
|
flag = MSG_DONTWAIT;
|
||||||
if ( (ret < sizeof (struct GNUNET_MessageHeader)) ||
|
if ( (ret < sizeof (struct GNUNET_MessageHeader)) ||
|
||||||
(ret != ntohs (hdr->size)) )
|
(ret != ntohs (hdr->size)) )
|
||||||
|
@ -391,6 +391,7 @@ TALER_CRYPTO_helper_esign_poll (struct TALER_CRYPTO_ExchangeSignHelper *esh)
|
|||||||
{
|
{
|
||||||
char buf[UINT16_MAX];
|
char buf[UINT16_MAX];
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
unsigned int retry_limit = 10;
|
||||||
const struct GNUNET_MessageHeader *hdr
|
const struct GNUNET_MessageHeader *hdr
|
||||||
= (const struct GNUNET_MessageHeader *) buf;
|
= (const struct GNUNET_MessageHeader *) buf;
|
||||||
int flag = MSG_DONTWAIT;
|
int flag = MSG_DONTWAIT;
|
||||||
@ -417,11 +418,18 @@ TALER_CRYPTO_helper_esign_poll (struct TALER_CRYPTO_ExchangeSignHelper *esh)
|
|||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Restarting connection to EdDSA helper, did not come up properly\n");
|
"Restarting connection to EdDSA helper, did not come up properly\n");
|
||||||
do_disconnect (esh);
|
do_disconnect (esh);
|
||||||
|
if (0 == retry_limit)
|
||||||
|
return; /* give up */
|
||||||
try_connect (esh);
|
try_connect (esh);
|
||||||
if (-1 == esh->sock)
|
if (-1 == esh->sock)
|
||||||
return; /* give up */
|
return; /* give up */
|
||||||
|
retry_limit--;
|
||||||
|
flag = MSG_DONTWAIT;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
flag = 0; /* syscall must be non-blocking this time */
|
flag = 0; /* syscall must be non-blocking this time */
|
||||||
|
}
|
||||||
continue; /* try again */
|
continue; /* try again */
|
||||||
}
|
}
|
||||||
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
|
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
|
||||||
|
Loading…
Reference in New Issue
Block a user