gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r19947 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r19947 - gnunet/src/mesh
Date: Wed, 22 Feb 2012 18:49:55 +0100

Author: bartpolot
Date: 2012-02-22 18:49:55 +0100 (Wed, 22 Feb 2012)
New Revision: 19947

Modified:
   gnunet/src/mesh/test_mesh_small.c
Log:
- Removed prefixes of DEBUG string, marked testcase output INFO, fixed several 
bugs regarding shutdown

Modified: gnunet/src/mesh/test_mesh_small.c
===================================================================
--- gnunet/src/mesh/test_mesh_small.c   2012-02-22 17:48:43 UTC (rev 19946)
+++ gnunet/src/mesh/test_mesh_small.c   2012-02-22 17:49:55 UTC (rev 19947)
@@ -182,7 +182,7 @@
   {
 #if VERBOSE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "test: Shutdown of peers failed!\n");
+                "Shutdown of peers failed!\n");
 #endif
     ok--;
   }
@@ -190,7 +190,7 @@
   {
 #if VERBOSE
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "test: All peers successfully shut down!\n");
+                "All peers successfully shut down!\n");
 #endif
   }
   GNUNET_CONFIGURATION_destroy (testing_cfg);
@@ -205,7 +205,7 @@
 {
 #if VERBOSE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "test: Ending test.\n");
+              "Ending test.\n");
 #endif
 
   if (disconnect_task != GNUNET_SCHEDULER_NO_TASK)
@@ -243,7 +243,7 @@
 disconnect_mesh_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext 
*tc)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "test: disconnecting mesh service of peers\n");
+              "disconnecting mesh service of peers\n");
   disconnect_task = GNUNET_SCHEDULER_NO_TASK;
   if (NULL != t)
   {
@@ -324,7 +324,7 @@
   struct GNUNET_MessageHeader *msg = buf;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "test:  tmt_rdy called\n");
+              " tmt_rdy called\n");
   if (size < sizeof (struct GNUNET_MessageHeader) || NULL == buf)
     return 0;
   msg->size = htons (sizeof (struct GNUNET_MessageHeader));
@@ -335,7 +335,7 @@
     if (data_sent < 1000)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "test:  Scheduling %d packet\n", data_sent);
+              " Scheduling %d packet\n", data_sent);
       GNUNET_SCHEDULER_add_now(&data_task, NULL);
     }
   }
@@ -366,9 +366,9 @@
   switch (client)
   {
   case 1L:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "test: Origin client got a response!\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Origin client got a response!\n");
     ok++;
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok);
     peers_responded++;
     data_ack++;
     if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
@@ -382,8 +382,8 @@
       return GNUNET_OK;
     if (test == SPEED_ACK)
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "test:  received ack %u\n", data_ack);
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              " received ack %u\n", data_ack);
       GNUNET_MESH_notify_transmit_ready (tunnel, GNUNET_NO, 0,
                                         GNUNET_TIME_UNIT_FOREVER_REL, sender,
                                         sizeof (struct GNUNET_MessageHeader),
@@ -401,21 +401,17 @@
       GAUGER ("MESH", "Tunnel 5 peers", 1000000.0 / total_time.rel_value,
               "packets/s");
     }
-    GNUNET_MESH_tunnel_destroy (tunnel);
-    if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
-    {
-      GNUNET_SCHEDULER_cancel (disconnect_task);
-      disconnect_task =
-          GNUNET_SCHEDULER_add_now (&disconnect_mesh_peers,
-                                        NULL);
-    }
+    GNUNET_assert (tunnel == t);
+    GNUNET_MESH_tunnel_destroy (t);
+    t = NULL;
     break;
   case 2L:
   case 3L:
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "test: Destination client %u got a message.\n",
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+                "Destination client %u got a message.\n",
                 client);
     ok++;
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok);
     if (SPEED != test)
     {
       GNUNET_MESH_notify_transmit_ready (tunnel, GNUNET_NO, 0,
@@ -426,8 +422,8 @@
     else
     {
       data_received++;
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "test:  received data %u\n", data_received);
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              " received data %u\n", data_received);
       if (data_received < 1000)
         return GNUNET_OK;
     }
@@ -471,14 +467,20 @@
                  const struct GNUNET_PeerIdentity *initiator,
                  const struct GNUNET_ATS_Information *atsi)
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "test: Incoming tunnel from %s to peer %d\n",
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Incoming tunnel from %s to peer %d\n",
               GNUNET_i2s (initiator), (long) cls);
   ok++;
-  if ((long) cls == 1L)
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok);
+  if ((long) cls == 2L)
     incoming_t = tunnel;
+  else if ((long) cls == 3L)
+    incoming_t2 = tunnel;
   else
-    incoming_t2 = tunnel;
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Incoming tunnel for unknown client %lu\n", (long) cls);
+  }
   if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
   {
     GNUNET_SCHEDULER_cancel (disconnect_task);
@@ -503,16 +505,23 @@
 {
   long i = (long) cls;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "test: Incoming tunnel disconnected at peer %d\n",
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "Incoming tunnel disconnected at peer %d\n",
               i);
   if (2L == i)
+  {
     ok++;
+    incoming_t = NULL;
+  }
   else if (3L == i)
+  {
     ok++;
+    incoming_t2 = NULL;
+  }
   else
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "test: Unknown peer! %d\n", i);
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Unknown peer! %d\n", i);
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok);
   peers_in_tunnel--;
   if (peers_in_tunnel > 0)
     return;
@@ -537,7 +546,7 @@
 dh (void *cls, const struct GNUNET_PeerIdentity *peer)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "test: peer %s disconnected\n",
+              "peer %s disconnected\n",
               GNUNET_i2s (peer));
   return;
 }
@@ -556,14 +565,19 @@
 {
   struct GNUNET_PeerIdentity *dest;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "test: peer %s connected\n", GNUNET_i2s (peer));
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+              "peer %s connected\n", GNUNET_i2s (peer));
 
   if (0 == memcmp (&d2->id, peer, sizeof (d2->id)) && (long) cls == 1L)
+  {
     ok++;
+  }
   if (test == MULTICAST && 0 == memcmp (&d3->id, peer, sizeof (d3->id)) &&
       (long) cls == 1L)
+  {
     ok++;
+  }
+  GNUNET_log (GNUNET_ERROR_TYPE_INFO, " ok: %d\n", ok);
   switch (test)
   {
   case UNICAST:
@@ -586,7 +600,7 @@
     disconnect_task =
         GNUNET_SCHEDULER_add_delayed (SHORT_TIME, &disconnect_mesh_peers, 
NULL);
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "test: Sending data...\n");
+                "Sending data...\n");
     peers_responded = 0;
     data_ack = 0;
     data_received = 0;
@@ -600,9 +614,9 @@
   else
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "test: Disconnect already run?\n");
+                "Disconnect already run?\n");
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "test: Aborting...\n");
+                "Aborting...\n");
   }
   return;
 }
@@ -611,17 +625,17 @@
 static void
 do_test (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: test_task\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test_task\n");
   if (test == MULTICAST)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "test: add peer 3\n");
+                "add peer 3\n");
     GNUNET_MESH_peer_request_connect_add (t, &d3->id);
   }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: add peer 2\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "add peer 2\n");
   GNUNET_MESH_peer_request_connect_add (t, &d2->id);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "test: schedule timeout in 90s\n");
+              "schedule timeout in 90s\n");
   if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
   {
     GNUNET_SCHEDULER_cancel (disconnect_task);
@@ -641,7 +655,7 @@
   GNUNET_MESH_ApplicationType app;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "test: connect_mesh_service\n");
+              "connect_mesh_service\n");
 
   d2 = GNUNET_TESTING_daemon_get (pg, 4);
   if (test == MULTICAST)
@@ -652,15 +666,15 @@
 
 #if VERBOSE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "test: connecting to mesh service of peer %s\n",
+              "connecting to mesh service of peer %s\n",
               GNUNET_i2s (&d1->id));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "test: connecting to mesh service of peer %s\n",
+              "connecting to mesh service of peer %s\n",
               GNUNET_i2s (&d2->id));
   if (test == MULTICAST)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "test: connecting to mesh service of peer %s\n",
+                "connecting to mesh service of peer %s\n",
                 GNUNET_i2s (&d3->id));
   }
 #endif
@@ -698,9 +712,9 @@
   if (emsg != NULL)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "test: Peergroup callback called with error, aborting 
test!\n");
+                "Peergroup callback called with error, aborting test!\n");
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "test: Error from testing: `%s'\n", emsg);
+                "Error from testing: `%s'\n", emsg);
     ok--;
     GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
     return;
@@ -709,9 +723,9 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               
"************************************************************\n");
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "test: Peer Group started successfully!\n");
+              "Peer Group started successfully!\n");
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "test: Have %u connections\n",
+              "Have %u connections\n",
               total_connections);
 #endif
 
@@ -730,12 +744,12 @@
 
     d1 = GNUNET_TESTING_daemon_get (pg, i);
     peer_id = GNUNET_PEER_intern (&d1->id);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test:   %u: %s\n",
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "  %u: %s\n",
                 peer_id, GNUNET_i2s (&d1->id));
   }
   d1 = GNUNET_TESTING_daemon_get (pg, 0);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "test: Peer looking: %s\n",
+              "Peer looking: %s\n",
               GNUNET_i2s (&d1->id));
   pid1 = GNUNET_PEER_intern (&d1->id);
 
@@ -775,10 +789,10 @@
   else
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "test: Problem with new connection (%s)\n",
+                "Problem with new connection (%s)\n",
                 emsg);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test:  (%s)\n", GNUNET_i2s (first));
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test:  (%s)\n", GNUNET_i2s (second));
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " (%s)\n", GNUNET_i2s (first));
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " (%s)\n", GNUNET_i2s (second));
   }
 
 }
@@ -812,7 +826,7 @@
 
 #if VERBOSE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "test: Starting daemons.\n");
+              "Starting daemons.\n");
   GNUNET_CONFIGURATION_set_value_string (testing_cfg, "testing",
                                          "use_progressbars", "YES");
 #endif
@@ -933,16 +947,16 @@
    */
   int ok_goal;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: Start\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Start\n");
   if (strstr (argv[0], "test_mesh_small_unicast") != NULL)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: UNICAST\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "UNICAST\n");
     test = UNICAST;
     ok_goal = 5;
   }
   else if (strstr (argv[0], "test_mesh_small_multicast") != NULL)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: MULTICAST\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MULTICAST\n");
     test = MULTICAST;
     ok_goal = 10;
   }
@@ -957,7 +971,7 @@
     * _________________________________
     * 5 x ok expected per peer
     */
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: SPEED_ACK\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SPEED_ACK\n");
     test = SPEED_ACK;
     ok_goal = 2003;
     argv2 [3] = NULL; // remove -L DEBUG
@@ -975,13 +989,13 @@
     * _________________________________
     * 5 x ok expected per peer
     */
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: SPEED\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "SPEED\n");
     test = SPEED;
     ok_goal = 1003;
   }
   else
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: UNKNOWN\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "UNKNOWN\n");
     test = SETUP;
     ok_goal = 0;
   }
@@ -996,10 +1010,10 @@
   if (ok_goal > ok)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                "test: FAILED! (%d/%d)\n", ok, ok_goal);
+                "FAILED! (%d/%d)\n", ok, ok_goal);
     return 1;
   }
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "test: success\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "success\n");
   return 0;
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]