misc bugfixes in reserves_in batch logic
This commit is contained in:
parent
5290453e36
commit
2dab1fac1c
@ -147,18 +147,13 @@ db_event_cb (void *cls,
|
|||||||
const void *extra,
|
const void *extra,
|
||||||
size_t extra_size)
|
size_t extra_size)
|
||||||
{
|
{
|
||||||
struct TEH_RequestContext *rc = cls;
|
struct ReservePoller *rp = cls;
|
||||||
struct ReservePoller *rp = rc->rh_ctx;
|
|
||||||
struct GNUNET_AsyncScopeSave old_scope;
|
struct GNUNET_AsyncScopeSave old_scope;
|
||||||
|
|
||||||
(void) extra;
|
(void) extra;
|
||||||
(void) extra_size;
|
(void) extra_size;
|
||||||
if (! rp->suspended)
|
if (! rp->suspended)
|
||||||
return; /* might get multiple wake-up events */
|
return; /* might get multiple wake-up events */
|
||||||
GNUNET_async_scope_enter (&rc->async_scope_id,
|
|
||||||
&old_scope);
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
|
||||||
"Resuming from long-polling on reserve\n");
|
|
||||||
TEH_check_invariants ();
|
TEH_check_invariants ();
|
||||||
rp->suspended = false;
|
rp->suspended = false;
|
||||||
MHD_resume_connection (rp->connection);
|
MHD_resume_connection (rp->connection);
|
||||||
@ -238,7 +233,8 @@ TEH_handler_reserves_get (struct TEH_RequestContext *rc,
|
|||||||
};
|
};
|
||||||
|
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Starting DB event listening\n");
|
"Starting DB event listening until %s\n",
|
||||||
|
GNUNET_TIME_absolute2s (rp->timeout));
|
||||||
rp->eh = TEH_plugin->event_listen (
|
rp->eh = TEH_plugin->event_listen (
|
||||||
TEH_plugin->cls,
|
TEH_plugin->cls,
|
||||||
GNUNET_TIME_absolute_get_remaining (rp->timeout),
|
GNUNET_TIME_absolute_get_remaining (rp->timeout),
|
||||||
@ -256,49 +252,27 @@ TEH_handler_reserves_get (struct TEH_RequestContext *rc,
|
|||||||
{
|
{
|
||||||
case GNUNET_DB_STATUS_SOFT_ERROR:
|
case GNUNET_DB_STATUS_SOFT_ERROR:
|
||||||
GNUNET_break (0); /* single-shot query should never have soft-errors */
|
GNUNET_break (0); /* single-shot query should never have soft-errors */
|
||||||
if (NULL != rp->eh)
|
|
||||||
{
|
|
||||||
TEH_plugin->event_listen_cancel (TEH_plugin->cls,
|
|
||||||
rp->eh);
|
|
||||||
rp->eh = NULL;
|
|
||||||
}
|
|
||||||
return TALER_MHD_reply_with_error (rc->connection,
|
return TALER_MHD_reply_with_error (rc->connection,
|
||||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||||
TALER_EC_GENERIC_DB_SOFT_FAILURE,
|
TALER_EC_GENERIC_DB_SOFT_FAILURE,
|
||||||
"get_reserve_balance");
|
"get_reserve_balance");
|
||||||
case GNUNET_DB_STATUS_HARD_ERROR:
|
case GNUNET_DB_STATUS_HARD_ERROR:
|
||||||
GNUNET_break (0);
|
GNUNET_break (0);
|
||||||
if (NULL != rp->eh)
|
|
||||||
{
|
|
||||||
TEH_plugin->event_listen_cancel (TEH_plugin->cls,
|
|
||||||
rp->eh);
|
|
||||||
rp->eh = NULL;
|
|
||||||
}
|
|
||||||
return TALER_MHD_reply_with_error (rc->connection,
|
return TALER_MHD_reply_with_error (rc->connection,
|
||||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||||
TALER_EC_GENERIC_DB_FETCH_FAILED,
|
TALER_EC_GENERIC_DB_FETCH_FAILED,
|
||||||
"get_reserve_balance");
|
"get_reserve_balance");
|
||||||
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
|
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
|
||||||
if (NULL != rp->eh)
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
{
|
"Got reserve balance of %s\n",
|
||||||
TEH_plugin->event_listen_cancel (TEH_plugin->cls,
|
TALER_amount2s (&rp->balance));
|
||||||
rp->eh);
|
|
||||||
rp->eh = NULL;
|
|
||||||
}
|
|
||||||
return TALER_MHD_REPLY_JSON_PACK (rc->connection,
|
return TALER_MHD_REPLY_JSON_PACK (rc->connection,
|
||||||
MHD_HTTP_OK,
|
MHD_HTTP_OK,
|
||||||
TALER_JSON_pack_amount ("balance",
|
TALER_JSON_pack_amount ("balance",
|
||||||
&rp->balance));
|
&rp->balance));
|
||||||
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
|
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
|
||||||
if ( (NULL != rp) ||
|
if (! GNUNET_TIME_absolute_is_future (rp->timeout))
|
||||||
(GNUNET_TIME_absolute_is_future (rp->timeout)) )
|
|
||||||
{
|
{
|
||||||
if (NULL != rp->eh)
|
|
||||||
{
|
|
||||||
TEH_plugin->event_listen_cancel (TEH_plugin->cls,
|
|
||||||
rp->eh);
|
|
||||||
rp->eh = NULL;
|
|
||||||
}
|
|
||||||
return TALER_MHD_reply_with_error (rc->connection,
|
return TALER_MHD_reply_with_error (rc->connection,
|
||||||
MHD_HTTP_NOT_FOUND,
|
MHD_HTTP_NOT_FOUND,
|
||||||
TALER_EC_EXCHANGE_RESERVES_STATUS_UNKNOWN,
|
TALER_EC_EXCHANGE_RESERVES_STATUS_UNKNOWN,
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -34,7 +34,6 @@
|
|||||||
*/
|
*/
|
||||||
struct WirewatchState
|
struct WirewatchState
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process for the wirewatcher.
|
* Process for the wirewatcher.
|
||||||
*/
|
*/
|
||||||
|
@ -353,7 +353,7 @@ maint_child_death (void *cls)
|
|||||||
|
|
||||||
while (TALER_TESTING_cmd_is_batch (cmd))
|
while (TALER_TESTING_cmd_is_batch (cmd))
|
||||||
cmd = TALER_TESTING_cmd_batch_get_current (cmd);
|
cmd = TALER_TESTING_cmd_batch_get_current (cmd);
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Got SIGCHLD for `%s'.\n",
|
"Got SIGCHLD for `%s'.\n",
|
||||||
cmd->label);
|
cmd->label);
|
||||||
is->child_death_task = NULL;
|
is->child_death_task = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user