/*
This file is part of GNUnet.
- (C)
+ Copyright (C)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
/**
/**
* Task that calculates the proof-of-work
*/
- GNUNET_SCHEDULER_TaskIdentifier calculate_pow_task;
+ struct GNUNET_SCHEDULER_Task * calculate_pow_task;
/**
* Size of msg (allocated after this struct)
void *callback_cls;
int sign_result;
+ if (0 == cx->pow % 1000)
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Checking pow %" PRIu64 ".\n", cx->pow);
if (GNUNET_YES ==
check_pow (&cx->timestamp,
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey) +
sizeof (struct GNUNET_TIME_Absolute) + cx->msg_size, cx->pow,
cx->matching_bits))
{
- cx->calculate_pow_task = GNUNET_SCHEDULER_NO_TASK;
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Found pow %" PRIu64 ".\n", cx->pow);
+ cx->calculate_pow_task = NULL;
result_block =
GNUNET_malloc (sizeof (struct GNUNET_SENSOR_crypto_pow_block) +
cx->msg_size);
GNUNET_SENSOR_crypto_pow_sign_cancel (cx);
if (NULL != callback)
callback (callback_cls, (GNUNET_OK == sign_result) ? result_block : NULL);
+ GNUNET_free (result_block);
return;
}
cx->pow++;
GNUNET_SENSOR_crypto_pow_sign_cancel (struct GNUNET_SENSOR_crypto_pow_context
*cx)
{
- if (GNUNET_SCHEDULER_NO_TASK != cx->calculate_pow_task)
+ if (NULL != cx->calculate_pow_task)
{
GNUNET_SCHEDULER_cancel (cx->calculate_pow_task);
- cx->calculate_pow_task = GNUNET_SCHEDULER_NO_TASK;
+ cx->calculate_pow_task = NULL;
}
GNUNET_free (cx);
cx = NULL;