-try to fix Florian's FIXME/endless loop, alas without test as Florian did not provide enough details for that
This commit is contained in:
parent
1ca5213894
commit
453d984569
@ -145,19 +145,11 @@ try_connect (struct TALER_CRYPTO_DenominationHelper *dh)
|
|||||||
/* Fix permissions on client UNIX domain socket,
|
/* Fix permissions on client UNIX domain socket,
|
||||||
just in case umask() is not set to enable group write */
|
just in case umask() is not set to enable group write */
|
||||||
{
|
{
|
||||||
char path[sizeof (dh->my_sa) + 1];
|
char path[sizeof (dh->my_sa.sun_path) + 1];
|
||||||
|
|
||||||
strncpy (path,
|
|
||||||
(const char *) &dh->my_sa,
|
|
||||||
sizeof (dh->my_sa));
|
|
||||||
path[sizeof (dh->my_sa)] = '\0';
|
|
||||||
|
|
||||||
{
|
|
||||||
char path[sizeof (dh->sa.sun_path) + 1];
|
|
||||||
|
|
||||||
strncpy (path,
|
strncpy (path,
|
||||||
dh->my_sa.sun_path,
|
dh->my_sa.sun_path,
|
||||||
sizeof (dh->my_sa.sun_path));
|
sizeof (path) - 1);
|
||||||
path[sizeof (dh->my_sa.sun_path)] = '\0';
|
path[sizeof (dh->my_sa.sun_path)] = '\0';
|
||||||
|
|
||||||
if (0 != chmod (path,
|
if (0 != chmod (path,
|
||||||
@ -168,7 +160,6 @@ try_connect (struct TALER_CRYPTO_DenominationHelper *dh)
|
|||||||
path);
|
path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
GNUNET_free (tmpdir);
|
GNUNET_free (tmpdir);
|
||||||
{
|
{
|
||||||
struct GNUNET_MessageHeader hdr = {
|
struct GNUNET_MessageHeader hdr = {
|
||||||
@ -445,6 +436,7 @@ TALER_CRYPTO_helper_denom_poll (struct TALER_CRYPTO_DenominationHelper *dh)
|
|||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
const struct GNUNET_MessageHeader *hdr
|
const struct GNUNET_MessageHeader *hdr
|
||||||
= (const struct GNUNET_MessageHeader *) buf;
|
= (const struct GNUNET_MessageHeader *) buf;
|
||||||
|
int flag = MSG_DONTWAIT;
|
||||||
|
|
||||||
try_connect (dh);
|
try_connect (dh);
|
||||||
if (-1 == dh->sock)
|
if (-1 == dh->sock)
|
||||||
@ -454,11 +446,14 @@ TALER_CRYPTO_helper_denom_poll (struct TALER_CRYPTO_DenominationHelper *dh)
|
|||||||
ret = recv (dh->sock,
|
ret = recv (dh->sock,
|
||||||
buf,
|
buf,
|
||||||
sizeof (buf),
|
sizeof (buf),
|
||||||
MSG_DONTWAIT);
|
flag);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
if (EAGAIN == errno)
|
if (EAGAIN == errno)
|
||||||
{
|
{
|
||||||
|
/* EAGAIN should only happen if we did not
|
||||||
|
already go through this loop */
|
||||||
|
GNUNET_assert (0 != flag);
|
||||||
if (dh->synced)
|
if (dh->synced)
|
||||||
break;
|
break;
|
||||||
if (! await_read_ready (dh))
|
if (! await_read_ready (dh))
|
||||||
@ -471,7 +466,7 @@ TALER_CRYPTO_helper_denom_poll (struct TALER_CRYPTO_DenominationHelper *dh)
|
|||||||
if (-1 == dh->sock)
|
if (-1 == dh->sock)
|
||||||
return; /* give up */
|
return; /* give up */
|
||||||
}
|
}
|
||||||
/* FIXME: We should not retry infinitely */
|
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,
|
||||||
@ -480,6 +475,7 @@ TALER_CRYPTO_helper_denom_poll (struct TALER_CRYPTO_DenominationHelper *dh)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flag = MSG_DONTWAIT;
|
||||||
if ( (ret < sizeof (struct GNUNET_MessageHeader)) ||
|
if ( (ret < sizeof (struct GNUNET_MessageHeader)) ||
|
||||||
(ret != ntohs (hdr->size)) )
|
(ret != ntohs (hdr->size)) )
|
||||||
{
|
{
|
||||||
|
@ -146,11 +146,11 @@ try_connect (struct TALER_CRYPTO_ExchangeSignHelper *esh)
|
|||||||
/* Fix permissions on client UNIX domain socket,
|
/* Fix permissions on client UNIX domain socket,
|
||||||
just in case umask() is not set to enable group write */
|
just in case umask() is not set to enable group write */
|
||||||
{
|
{
|
||||||
char path[sizeof (esh->sa.sun_path) + 1];
|
char path[sizeof (esh->my_sa.sun_path) + 1];
|
||||||
|
|
||||||
strncpy (path,
|
strncpy (path,
|
||||||
esh->my_sa.sun_path,
|
esh->my_sa.sun_path,
|
||||||
sizeof (esh->my_sa.sun_path));
|
sizeof (path) - 1);
|
||||||
path[sizeof (esh->my_sa.sun_path)] = '\0';
|
path[sizeof (esh->my_sa.sun_path)] = '\0';
|
||||||
|
|
||||||
if (0 != chmod (path,
|
if (0 != chmod (path,
|
||||||
@ -393,6 +393,7 @@ TALER_CRYPTO_helper_esign_poll (struct TALER_CRYPTO_ExchangeSignHelper *esh)
|
|||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
const struct GNUNET_MessageHeader *hdr
|
const struct GNUNET_MessageHeader *hdr
|
||||||
= (const struct GNUNET_MessageHeader *) buf;
|
= (const struct GNUNET_MessageHeader *) buf;
|
||||||
|
int flag = MSG_DONTWAIT;
|
||||||
|
|
||||||
try_connect (esh);
|
try_connect (esh);
|
||||||
if (-1 == esh->sock)
|
if (-1 == esh->sock)
|
||||||
@ -402,11 +403,12 @@ TALER_CRYPTO_helper_esign_poll (struct TALER_CRYPTO_ExchangeSignHelper *esh)
|
|||||||
ret = recv (esh->sock,
|
ret = recv (esh->sock,
|
||||||
buf,
|
buf,
|
||||||
sizeof (buf),
|
sizeof (buf),
|
||||||
MSG_DONTWAIT);
|
flag);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
if (EAGAIN == errno)
|
if (EAGAIN == errno)
|
||||||
{
|
{
|
||||||
|
GNUNET_assert (0 != flag);
|
||||||
if (esh->synced)
|
if (esh->synced)
|
||||||
break;
|
break;
|
||||||
if (! await_read_ready (esh))
|
if (! await_read_ready (esh))
|
||||||
@ -419,6 +421,7 @@ TALER_CRYPTO_helper_esign_poll (struct TALER_CRYPTO_ExchangeSignHelper *esh)
|
|||||||
if (-1 == esh->sock)
|
if (-1 == esh->sock)
|
||||||
return; /* give up */
|
return; /* give up */
|
||||||
}
|
}
|
||||||
|
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,
|
||||||
@ -427,6 +430,7 @@ TALER_CRYPTO_helper_esign_poll (struct TALER_CRYPTO_ExchangeSignHelper *esh)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flag = MSG_DONTWAIT;
|
||||||
if ( (ret < sizeof (struct GNUNET_MessageHeader)) ||
|
if ( (ret < sizeof (struct GNUNET_MessageHeader)) ||
|
||||||
(ret != ntohs (hdr->size)) )
|
(ret != ntohs (hdr->size)) )
|
||||||
{
|
{
|
||||||
|
@ -883,8 +883,9 @@ setup_key (struct DenominationKey *dk,
|
|||||||
}
|
}
|
||||||
GNUNET_free (buf);
|
GNUNET_free (buf);
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Setup fresh private key %s in `%s'\n",
|
"Setup fresh private key %s at %s in `%s'\n",
|
||||||
GNUNET_h2s (&dk->h_denom_pub),
|
GNUNET_h2s (&dk->h_denom_pub),
|
||||||
|
GNUNET_STRINGS_absolute_time_to_string (dk->anchor),
|
||||||
dk->filename);
|
dk->filename);
|
||||||
dk->denom_priv.rsa_private_key = priv;
|
dk->denom_priv.rsa_private_key = priv;
|
||||||
dk->denom_pub.rsa_public_key = pub;
|
dk->denom_pub.rsa_public_key = pub;
|
||||||
|
@ -146,6 +146,7 @@ key_cb (void *cls,
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GNUNET_break (NULL != denom_pub);
|
GNUNET_break (NULL != denom_pub);
|
||||||
for (unsigned int i = 0; i<MAX_KEYS; i++)
|
for (unsigned int i = 0; i<MAX_KEYS; i++)
|
||||||
if (! keys[i].valid)
|
if (! keys[i].valid)
|
||||||
@ -253,6 +254,7 @@ test_signing (struct TALER_CRYPTO_DenominationHelper *dh)
|
|||||||
{
|
{
|
||||||
void *buf;
|
void *buf;
|
||||||
size_t buf_size;
|
size_t buf_size;
|
||||||
|
|
||||||
GNUNET_assert (GNUNET_YES ==
|
GNUNET_assert (GNUNET_YES ==
|
||||||
TALER_rsa_blind (&m_hash,
|
TALER_rsa_blind (&m_hash,
|
||||||
&bks,
|
&bks,
|
||||||
|
Loading…
Reference in New Issue
Block a user