handle revoke followed immediately by a sign request

This commit is contained in:
Christian Grothoff 2021-11-22 15:19:59 +01:00
parent c7dc62b42e
commit 0ac1b7abad
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
3 changed files with 64 additions and 58 deletions

View File

@ -1678,8 +1678,8 @@ parse_history_common_args (const struct TALER_FAKEBANK_Handle *h,
MHD_HTTP_BAD_REQUEST, MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MALFORMED, TALER_EC_GENERIC_PARAMETER_MALFORMED,
"delta")) "delta"))
? GNUNET_NO ? GNUNET_NO
: GNUNET_SYSERR; : GNUNET_SYSERR;
} }
if ( (NULL != long_poll_ms) && if ( (NULL != long_poll_ms) &&
(1 != sscanf (long_poll_ms, (1 != sscanf (long_poll_ms,
@ -1697,8 +1697,8 @@ parse_history_common_args (const struct TALER_FAKEBANK_Handle *h,
MHD_HTTP_BAD_REQUEST, MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MALFORMED, TALER_EC_GENERIC_PARAMETER_MALFORMED,
"long_poll_ms")) "long_poll_ms"))
? GNUNET_NO ? GNUNET_NO
: GNUNET_SYSERR; : GNUNET_SYSERR;
} }
if ( (NULL != start) && if ( (NULL != start) &&
(1 != sscanf (start, (1 != sscanf (start,
@ -1716,8 +1716,8 @@ parse_history_common_args (const struct TALER_FAKEBANK_Handle *h,
MHD_HTTP_BAD_REQUEST, MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MALFORMED, TALER_EC_GENERIC_PARAMETER_MALFORMED,
"start")) "start"))
? GNUNET_NO ? GNUNET_NO
: GNUNET_SYSERR; : GNUNET_SYSERR;
} }
if (NULL == start) if (NULL == start)
ha->start_idx = (d > 0) ? 0 : h->serial_counter; ha->start_idx = (d > 0) ? 0 : h->serial_counter;
@ -1732,8 +1732,8 @@ parse_history_common_args (const struct TALER_FAKEBANK_Handle *h,
MHD_HTTP_BAD_REQUEST, MHD_HTTP_BAD_REQUEST,
TALER_EC_GENERIC_PARAMETER_MALFORMED, TALER_EC_GENERIC_PARAMETER_MALFORMED,
"delta")) "delta"))
? GNUNET_NO ? GNUNET_NO
: GNUNET_SYSERR; : GNUNET_SYSERR;
} }
ha->lp_timeout ha->lp_timeout
= GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,

View File

@ -532,8 +532,8 @@ withdraw_traits (void *cls,
}; };
return TALER_TESTING_get_trait ((ws->expected_response_code == MHD_HTTP_OK) return TALER_TESTING_get_trait ((ws->expected_response_code == MHD_HTTP_OK)
? &traits[0] /* we have reserve history */ ? &traits[0] /* we have reserve history */
: &traits[1],/* skip reserve history */ : &traits[1], /* skip reserve history */
ret, ret,
trait, trait,
index); index);

View File

@ -232,63 +232,69 @@ TES_read_work (void *cls,
size_t off = 0; size_t off = 0;
uint16_t msize; uint16_t msize;
const struct GNUNET_MessageHeader *hdr; const struct GNUNET_MessageHeader *hdr;
enum GNUNET_GenericReturnValue ret;
do while (1)
{ {
ssize_t recv_size; do
recv_size = recv (client->csock,
&buf[off],
sizeof (client->iobuf) - off,
0);
if (-1 == recv_size)
{ {
if ( (0 == off) && ssize_t recv_size;
(EAGAIN == errno) )
return GNUNET_NO; recv_size = recv (client->csock,
if ( (EINTR == errno) || &buf[off],
(EAGAIN == errno) ) sizeof (client->iobuf) - off,
0);
if (-1 == recv_size)
{ {
GNUNET_log_strerror (GNUNET_ERROR_TYPE_DEBUG, if ( (0 == off) &&
"recv"); (EAGAIN == errno) )
continue; return GNUNET_NO;
if ( (EINTR == errno) ||
(EAGAIN == errno) )
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_DEBUG,
"recv");
continue;
}
if (ECONNRESET != errno)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
"recv");
return GNUNET_SYSERR;
} }
if (ECONNRESET != errno) if (0 == recv_size)
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, {
"recv"); /* regular disconnect? */
return GNUNET_SYSERR; GNUNET_break_op (0 == off);
} return GNUNET_SYSERR;
if (0 == recv_size) }
{ off += recv_size;
/* regular disconnect? */ if (off < sizeof (struct GNUNET_MessageHeader))
GNUNET_break_op (0 == off); continue;
return GNUNET_SYSERR; hdr = (const struct GNUNET_MessageHeader *) buf;
} msize = ntohs (hdr->size);
off += recv_size;
if (off < sizeof (struct GNUNET_MessageHeader))
continue;
hdr = (const struct GNUNET_MessageHeader *) buf;
msize = ntohs (hdr->size);
#if 0 #if 0
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Received message of type %u with %u bytes\n", "Received message of type %u with %u bytes\n",
(unsigned int) ntohs (hdr->type), (unsigned int) ntohs (hdr->type),
(unsigned int) msize); (unsigned int) msize);
#endif #endif
if (msize < sizeof (struct GNUNET_MessageHeader)) if (msize < sizeof (struct GNUNET_MessageHeader))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
} while (off < msize); } while (off < msize);
if (off > msize) ret = dispatch (client,
{ hdr);
GNUNET_break_op (0); if ( (GNUNET_OK != ret) ||
return GNUNET_SYSERR; (off == msize) )
return ret;
memmove (buf,
&buf[msize],
off - msize);
off -= msize;
} }
return dispatch (client,
hdr);
} }