add nick name for cached records
[oweals/gnunet.git] / src / regex / gnunet-regex-profiler.c
index 75f3d96a1c1319bee9cad46d3b9a311c99130ed3..5a7cb9acdfd9f053b178ad20fe4ae3126729d755 100644 (file)
@@ -596,9 +596,11 @@ stats_cb (void *cls,
   peer_cnt++;
   peer = &peers[peer_cnt];
 
+  fprintf (stderr, "s");
   if (peer_cnt == num_peers)
   {
     struct GNUNET_TIME_Relative delay = { 100 };
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "\nCollecting stats finished. Shutting down.\n");
     shutdown_task = GNUNET_SCHEDULER_add_delayed (delay, &do_shutdown, NULL);
     result = GNUNET_OK;
   }
@@ -723,7 +725,7 @@ regex_found_handler (void *cls,
 
   if (GNUNET_YES == peer->search_str_matched)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "String %s on peer %u already matched!\n",
                 peer->search_str, peer->id);
     return;
@@ -795,7 +797,7 @@ regex_found_handler (void *cls,
       search_timeout_task = GNUNET_SCHEDULER_NO_TASK;
     }
 
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Collecting stats and shutting down.\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Collecting stats.\n");
     GNUNET_SCHEDULER_add_now (&do_collect_stats, NULL);
   }
 }
@@ -822,7 +824,7 @@ search_timed_out (void *cls, const struct GNUNET_SCHEDULER_TaskContext * tc)
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Search timed out after %s."
-              "Collecting stats and shutting down.\n", 
+              "Collecting stats and shutting down.\n",
               GNUNET_STRINGS_relative_time_to_string (search_timeout_time,
                                                       GNUNET_NO));
 
@@ -927,6 +929,11 @@ daemon_started (void *cls, struct GNUNET_TESTBED_Operation *op,
                 "Failed to start/stop daemon at peer %u: %s\n", peer->id, emsg);
     GNUNET_abort ();
   }
+  else
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "Deamon %u started successfully\n", peer->id);
+  }
 
   /* Find a peer to look for a string matching the regex announced */
   search_peer = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
@@ -1001,7 +1008,7 @@ announce_next_regex (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Starting daemon %u\n", next_search);
   peer = &peers[next_search];
-  peer->daemon_op = 
+  peer->daemon_op =
   GNUNET_TESTBED_peer_manage_service (NULL,
                                       peer->peer_handle,
                                       "regexprofiler",
@@ -1097,16 +1104,18 @@ dht_da (void *cls, void *op_result)
  * Signature of a main function for a testcase.
  *
  * @param cls NULL
+ * @param h the run handle
  * @param num_peers_ number of peers in 'peers'
- * @param peers handle to peers run in the testbed.  NULL upon timeout (see
+ * @param testbed_peers handle to peers run in the testbed.  NULL upon timeout (see
  *          GNUNET_TESTBED_test_run()).
  * @param links_succeeded the number of overlay link connection attempts that
  *          succeeded
  * @param links_failed the number of overlay link connection attempts that
  *          failed
  */
-static void 
+static void
 test_master (void *cls,
+             struct GNUNET_TESTBED_RunHandle *h,
              unsigned int num_peers_,
              struct GNUNET_TESTBED_Peer **testbed_peers,
              unsigned int links_succeeded,
@@ -1139,7 +1148,7 @@ test_master (void *cls,
     settle_time =
       GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
                                      10 * num_peers);
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO, 
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                 "Waiting for DHT for %s to settle new connections.\n\n",
                 GNUNET_STRINGS_relative_time_to_string(settle_time, GNUNET_NO));
     GNUNET_SCHEDULER_add_delayed (settle_time, &do_announce, NULL);
@@ -1159,7 +1168,7 @@ test_master (void *cls,
  * @param event information on what is happening
  */
 static void
-master_controller_cb (void *cls, 
+master_controller_cb (void *cls,
                       const struct GNUNET_TESTBED_EventInformation *event)
 {
   switch (event->type)
@@ -1306,7 +1315,7 @@ run (void *cls, char *const *args, const char *cfgfile,
                                            "REANNOUNCE_PERIOD_MAX",
                                            &reannounce_period_max))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                 "reannounce_period_max not given. Using 10 minutes.\n");
     reannounce_period_max =
       GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 10);
@@ -1326,7 +1335,7 @@ run (void *cls, char *const *args, const char *cfgfile,
     shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
     return;
   }
-  if (-1 == (num_peers = GNUNET_DISK_directory_scan (policy_dir, NULL, NULL)))
+  if (0 >= (int) (num_peers = GNUNET_DISK_directory_scan (policy_dir, NULL, NULL)))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 _("No files found in `%s'\n"),
@@ -1355,7 +1364,7 @@ run (void *cls, char *const *args, const char *cfgfile,
     shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
     return;
   }
-  if (0 >= num_peers || NULL == search_strings)
+  if ( (0 == num_peers) || (NULL == search_strings))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 _("Error loading search strings. Exiting.\n"));
@@ -1386,9 +1395,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   /* Initialize peers */
   peers = GNUNET_malloc (sizeof (struct RegexPeer) * num_peers);
   for (i = 0; i < num_peers; i++)
-  {
     peers[i].id = i;
-  }
 
   GNUNET_CONFIGURATION_set_value_number (cfg,
                                          "TESTBED", "OVERLAY_RANDOM_LINKS",
@@ -1417,6 +1424,8 @@ run (void *cls, char *const *args, const char *cfgfile,
                                            "SETUP_TIMEOUT",
                                            &abort_time))
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "SETUP_TIMEOUT not given. Using 15 minutes.\n");
     abort_time =
       GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 15);
   }
@@ -1425,6 +1434,9 @@ run (void *cls, char *const *args, const char *cfgfile,
       GNUNET_SCHEDULER_add_delayed (abort_time,
                                     &do_abort,
                                     (void*) __LINE__);
+  GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+              "setup_timeout: %s\n",
+              GNUNET_STRINGS_relative_time_to_string (abort_time, GNUNET_YES));
 }