-keep track of messages passed to mq
[oweals/gnunet.git] / src / sensor / sensor_util_lib_crypto.c
index 6767e118b4a207b7a123a1428eb598fd3ebaf7ca..0586879c76ab7216e0b24ca8335605e970678cbf 100644 (file)
@@ -1,6 +1,6 @@
 /*
      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
@@ -14,8 +14,8 @@
 
      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.
 */
 
 /**
@@ -65,7 +65,7 @@ struct GNUNET_SENSOR_crypto_pow_context
   /**
    * 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)
@@ -148,13 +148,16 @@ calculate_pow (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   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);
@@ -194,10 +197,10 @@ void
 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;