- leaks
[oweals/gnunet.git] / src / mesh / test_mesh_local_traffic.c
index 4dea64b4018de30ff75ba2f60babd6a36c7df1d9..b422c64e843039702884bc179b9a2412d87506c9 100644 (file)
@@ -240,17 +240,23 @@ data_callback (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx,
     started = GNUNET_YES;
     start_time = GNUNET_TIME_absolute_get();
     if (FWD != test) // Send leaf -> root
-      GNUNET_MESH_notify_transmit_ready (tunnel, GNUNET_NO,
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending first BCK data\n");
+      GNUNET_MESH_notify_transmit_ready (t_bck, GNUNET_NO,
                                         GNUNET_TIME_UNIT_FOREVER_REL,
                                         NULL,
                                         sizeof (struct test_traffic_message),
                                         &tmt_rdy, &two);
+    }
     if (BCK != test) // Send root -> leaf
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending first FWD data\n");
       GNUNET_MESH_notify_transmit_ready (t_fwd, GNUNET_NO,
                                         GNUNET_TIME_UNIT_FOREVER_REL,
                                         &peer_id,
                                         sizeof (struct test_traffic_message),
                                         &tmt_rdy, &one);
+    }
     return GNUNET_OK;
   }
 
@@ -270,7 +276,7 @@ data_callback (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx,
   }
   msg = (struct test_traffic_message *) message;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got data packet # %u [%u]\n",
-              ntohl (msg->data), got + 1);
+              ntohl (msg->data), *got + 1);
   (*got)++;
   if (target == *got)
   {
@@ -506,7 +512,7 @@ main (int argc, char *argv[])
     FPRINTF (stderr, "\nTest time %llu ms\n",
              (unsigned long long) total_time.rel_value);
     FPRINTF (stderr, "Test payload bandwidth: %f kb/s\n",
-             4 * 1000.0 / total_time.rel_value); // 4bytes * ms
+             total_traffic * 4.0 / total_time.rel_value); // 4bytes * kb/ms
     FPRINTF (stderr, "Test throughput: %f packets/s\n\n",
              total_traffic * 1000.0 / total_time.rel_value); // 1000 packets * ms
     GAUGER ("MESH",