- Act malicious API complete
[oweals/gnunet.git] / src / dht / test_dht_monitor.c
index 74024edf26677f6b3594b2b0d19a44cfdd764586..98791d28f76b766ea64210782ff4e55fb326b989 100644 (file)
@@ -42,7 +42,7 @@
 /**
  * Information we keep for each GET operation.
  */
-struct GetOperation 
+struct GetOperation
 {
   /**
    * DLL.
@@ -79,7 +79,7 @@ static struct GetOperation *get_tail;
 
 /**
  * Array of the testbed's peers.
- */ 
+ */
 static struct GNUNET_TESTBED_Peer **my_peers;
 
 /**
@@ -109,9 +109,9 @@ static unsigned int monitor_counter;
  *
  * @param cls the 'struct GNUNET_DHT_TestContext'
  * @param tc scheduler context
- */ 
+ */
 static void
-shutdown_task (void *cls, 
+shutdown_task (void *cls,
               const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct GNUNET_DHT_TEST_Context *ctx = cls;
@@ -177,7 +177,7 @@ dht_get_handler (void *cls, struct GNUNET_TIME_Absolute exp,
     GNUNET_break (0);
     return;
   }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Get successful\n");
   GNUNET_DHT_get_stop (get_op->get);
   GNUNET_CONTAINER_DLL_remove (get_head,
@@ -195,7 +195,7 @@ dht_get_handler (void *cls, struct GNUNET_TIME_Absolute exp,
 
 /**
  * Task to put the id of each peer into the DHT.
- * 
+ *
  * @param cls array with NUM_PEERS DHT handles
  * @param tc Task context
  */
@@ -208,7 +208,7 @@ do_puts (void *cls,
   struct GNUNET_HashCode value;
   unsigned int i;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Putting values into DHT\n");
   for (i = 0; i < NUM_PEERS; i++)
   {
@@ -217,13 +217,13 @@ do_puts (void *cls,
     GNUNET_DHT_put (hs[i], &key, 10U,
                     GNUNET_DHT_RO_RECORD_ROUTE |
                     GNUNET_DHT_RO_DEMULTIPLEX_EVERYWHERE,
-                    GNUNET_BLOCK_TYPE_TEST, 
-                   sizeof (value), &value, 
+                    GNUNET_BLOCK_TYPE_TEST,
+                   sizeof (value), &value,
                    GNUNET_TIME_UNIT_FOREVER_ABS,
-                    GNUNET_TIME_UNIT_FOREVER_REL, 
+                    GNUNET_TIME_UNIT_FOREVER_REL,
                    NULL, NULL);
   }
-  put_task = GNUNET_SCHEDULER_add_delayed (PUT_FREQUENCY, 
+  put_task = GNUNET_SCHEDULER_add_delayed (PUT_FREQUENCY,
                                           &do_puts, hs);
 }
 
@@ -296,7 +296,7 @@ monitor_put_cb (void *cls,
   i = (unsigned int) (long) cls;
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "%u got a PUT message for key %s with %u bytes\n",
-              i, 
+              i,
              GNUNET_h2s (key), size);
   monitor_counter++;
 }
@@ -334,7 +334,7 @@ monitor_res_cb (void *cls,
   i = (unsigned int) (long) cls;
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "%u got a REPLY message for key %s with %u bytes\n",
-              i, 
+              i,
              GNUNET_h2s (key), size);
   monitor_counter++;
 }
@@ -372,7 +372,7 @@ run (void *cls,
                                            &monitor_res_cb,
                                            &monitor_put_cb,
                                            (void *)(long)i);
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
              "Peers setup, starting test\n");
   put_task = GNUNET_SCHEDULER_add_now (&do_puts, dhts);
   for (i=0;i<num_peers;i++)
@@ -380,11 +380,11 @@ run (void *cls,
     GNUNET_CRYPTO_hash (&i, sizeof (i), &key);
     for (j=0;j<num_peers;j++)
     {
-      get_op = GNUNET_malloc (sizeof (struct GetOperation));
+      get_op = GNUNET_new (struct GetOperation);
       GNUNET_CONTAINER_DLL_insert (get_head,
                                   get_tail,
                                   get_op);
-      get_op->get = GNUNET_DHT_get_start (dhts[j], 
+      get_op->get = GNUNET_DHT_get_start (dhts[j],
                                          GNUNET_BLOCK_TYPE_TEST, /* type */
                                          &key,      /*key to search */
                                          4U,     /* replication level */
@@ -394,7 +394,7 @@ run (void *cls,
                                          &dht_get_handler, get_op);
     }
   }
-  timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, 
+  timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
                                               &shutdown_task, ctx);
 }