general intendation
authorMatthias Wachs <wachs@net.in.tum.de>
Tue, 30 Aug 2011 15:44:59 +0000 (15:44 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Tue, 30 Aug 2011 15:44:59 +0000 (15:44 +0000)
some progress entertainment in transport/test_transport_api_disconnect.c

src/transport/gnunet-service-transport_clients.c
src/transport/test_transport_api.c
src/transport/test_transport_api_disconnect.c
src/transport/test_transport_api_reliability.c
src/transport/test_transport_api_unreliability.c

index ce2a98333a4a8e61086e51e8b9bf45579bf9f233..551d5550e3a8a9a833f3cf8717559980a43b3f28 100644 (file)
@@ -482,12 +482,12 @@ clients_handle_send (void *cls, struct GNUNET_SERVER_Client *client,
 
   tc = lookup_client (client);
   if (NULL == tc)
-    {
-      /* client asked for transmission before 'START' */
-      GNUNET_break (0);
-      GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
-      return;
-    }
+  {
+    /* client asked for transmission before 'START' */
+    GNUNET_break (0);
+    GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+    return;
+  }
 
   size = ntohs (message->size);
   if (size <
@@ -902,7 +902,7 @@ GST_clients_unicast (struct GNUNET_SERVER_Client *client,
 
   tc = lookup_client (client);
   if (NULL == tc)
-    return;  /* client got disconnected in the meantime, drop message */    
+    return;                     /* client got disconnected in the meantime, drop message */
   unicast (tc, msg, may_drop);
 }
 
index 8f05d996d6b2f85af48d4bc5c6c3e249c1fd539a..365b833da70dc6d86e42ae735febef09b35fb9a3 100644 (file)
@@ -297,23 +297,20 @@ main (int argc, char *argv[])
   GNUNET_asprintf (&cfg_file_p2, "%s_peer2.conf", filename);
   GNUNET_free (backup);
 
-  if ((strstr (argv[0], "tcp_nat") != NULL) || (strstr (argv[0], "udp_nat") != NULL))
+  if ((strstr (argv[0], "tcp_nat") != NULL) ||
+      (strstr (argv[0], "udp_nat") != NULL))
   {
     nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server");
     if (GNUNET_NO == nat_res)
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-          "Cannot run NAT test: `%s' %s \n",
-          "gnunet-nat-server",
-           "SUID not set");
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Cannot run NAT test: `%s' %s \n",
+                  "gnunet-nat-server", "SUID not set");
       return 0;
     }
-    if (GNUNET_SYSERR ==  nat_res)
+    if (GNUNET_SYSERR == nat_res)
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-          "Cannot run NAT test: `%s' %s \n",
-          "gnunet-nat-server",
-          "file not found");
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Cannot run NAT test: `%s' %s \n",
+                  "gnunet-nat-server", "file not found");
       return 0;
     }
 
index a9cf0b4ded635986d8d02a1736815f48f557e633..540d3b7290bf4a546b15560563235c60d2405a68 100644 (file)
@@ -326,9 +326,16 @@ peers_disconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
   while (peers_connected > 0) ;
 
   if (counter < ITERATIONS)
+  {
+    if ((counter % (ITERATIONS / 10)) == 0)
+      fprintf (stderr, "%u%%..", (counter / (ITERATIONS / 10)) * 10);
     peers_connect ();
+  }
   else
+  {
+    fprintf (stderr, "100%%\n");
     end ();
+  }
 }
 
 static void
index 4cacf9c11dd56db1753b9826de8bcd4ce0959200..8f48008a6271f5fc496fc2c6d8aa9fcc890b9602 100644 (file)
@@ -118,9 +118,10 @@ end ()
   delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value;
   fprintf (stderr, "\nThroughput was %llu kb/s\n",
            total_bytes * 1000 / 1024 / delta);
-  GNUNET_asprintf(&value_name, "reliable_%s", test_name);
-  GAUGER ("TRANSPORT", value_name, (int)(total_bytes * 1000 / 1024 /delta), "kb/s");
-  GNUNET_free(value_name);
+  GNUNET_asprintf (&value_name, "reliable_%s", test_name);
+  GAUGER ("TRANSPORT", value_name, (int) (total_bytes * 1000 / 1024 / delta),
+          "kb/s");
+  GNUNET_free (value_name);
 
   if (die_task != GNUNET_SCHEDULER_NO_TASK)
     GNUNET_SCHEDULER_cancel (die_task);
@@ -395,7 +396,8 @@ check ()
 #endif
   ok = 1;
   GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
-                      "test-transport-api-reliability", "nohelp", options, &run, &ok);
+                      "test-transport-api-reliability", "nohelp", options, &run,
+                      &ok);
 
   return ok;
 }
@@ -418,7 +420,7 @@ main (int argc, char *argv[])
   char *backup = pch;
   char *filename = NULL;
   char *dotexe;
-  char *src_name  = strdup (__FILE__);
+  char *src_name = strdup (__FILE__);
   char *split = NULL;
 
   /* get executable filename */
@@ -442,7 +444,7 @@ main (int argc, char *argv[])
   if (split != NULL)
   {
     split[0] = '\0';
-    test_name = strdup(&filename[strlen(src_name)+1]);
+    test_name = strdup (&filename[strlen (src_name) + 1]);
   }
   else
     test_name = NULL;
@@ -450,23 +452,20 @@ main (int argc, char *argv[])
   GNUNET_free (src_name);
   GNUNET_free (backup);
 
-  if ((strstr (argv[0], "tcp_nat") != NULL) || (strstr (argv[0], "udp_nat") != NULL))
+  if ((strstr (argv[0], "tcp_nat") != NULL) ||
+      (strstr (argv[0], "udp_nat") != NULL))
   {
     nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server");
     if (GNUNET_NO == nat_res)
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-          "Cannot run NAT test: `%s' %s \n",
-          "gnunet-nat-server",
-           "SUID not set");
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Cannot run NAT test: `%s' %s \n",
+                  "gnunet-nat-server", "SUID not set");
       return 0;
     }
-    if (GNUNET_SYSERR ==  nat_res)
+    if (GNUNET_SYSERR == nat_res)
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-          "Cannot run NAT test: `%s' %s \n",
-          "gnunet-nat-server",
-          "file not found");
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Cannot run NAT test: `%s' %s \n",
+                  "gnunet-nat-server", "file not found");
       return 0;
     }
   }
index 74afc9c90b7a41416991a6d6b9ce13fbc90c66a4..6a86617a93621eb641488944e1b89d49924eea05 100644 (file)
@@ -123,9 +123,10 @@ end ()
   delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value;
   fprintf (stderr, "\nThroughput was %llu kb/s\n",
            total_bytes * 1000 / 1024 / delta);
-  GNUNET_asprintf(&value_name, "unreliable_%s", test_name);
-  GAUGER ("TRANSPORT", value_name, (int)(total_bytes * 1000 / 1024 /delta), "kb/s");
-  GNUNET_free(value_name);
+  GNUNET_asprintf (&value_name, "unreliable_%s", test_name);
+  GAUGER ("TRANSPORT", value_name, (int) (total_bytes * 1000 / 1024 / delta),
+          "kb/s");
+  GNUNET_free (value_name);
 
   if (die_task != GNUNET_SCHEDULER_NO_TASK)
     GNUNET_SCHEDULER_cancel (die_task);
@@ -140,6 +141,7 @@ end ()
   ok = 0;
 
   int i;
+
   for (i = 0; i < TOTAL_MSGS; i++)
   {
     if (get_bit (bitmap, i) == 0)
@@ -342,9 +344,8 @@ notify_ready (void *cls, size_t size, void *buf)
   while (size - ret >= s);
   if (n < TOTAL_MSGS)
   {
-    th  =
-        GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, s, 0, TIMEOUT,
-                                                &notify_ready, NULL);
+    th = GNUNET_TRANSPORT_notify_transmit_ready (p2->th, &p1->id, s, 0, TIMEOUT,
+                                                 &notify_ready, NULL);
     msg_scheduled = n;
   }
   else
@@ -353,9 +354,7 @@ notify_ready (void *cls, size_t size, void *buf)
                 "All messages scheduled to be sent!!\n");
     if (GNUNET_SCHEDULER_NO_TASK != die_task)
       GNUNET_SCHEDULER_cancel (die_task);
-    die_task =
-        GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly,
-                                      NULL);
+    die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, NULL);
   }
   if (n % 5000 == 0)
   {
@@ -460,7 +459,8 @@ check ()
   ok = GNUNET_SYSERR;
 
   GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv,
-                      "test-transport-api-unreliability", "nohelp", options, &run, &ok);
+                      "test-transport-api-unreliability", "nohelp", options,
+                      &run, &ok);
 
   return ok;
 }
@@ -483,7 +483,7 @@ main (int argc, char *argv[])
   char *backup = pch;
   char *filename = NULL;
   char *dotexe;
-  char *src_name  = strdup (__FILE__);
+  char *src_name = strdup (__FILE__);
   char *split = NULL;
 
   /* get executable filename */
@@ -507,7 +507,7 @@ main (int argc, char *argv[])
   if (split != NULL)
   {
     split[0] = '\0';
-    test_name = strdup(&filename[strlen(src_name)+1]);
+    test_name = strdup (&filename[strlen (src_name) + 1]);
   }
   else
     test_name = NULL;
@@ -515,23 +515,20 @@ main (int argc, char *argv[])
   GNUNET_free (src_name);
   GNUNET_free (backup);
 
-  if ((strstr (argv[0], "tcp_nat") != NULL) || (strstr (argv[0], "udp_nat") != NULL))
+  if ((strstr (argv[0], "tcp_nat") != NULL) ||
+      (strstr (argv[0], "udp_nat") != NULL))
   {
     nat_res = GNUNET_OS_check_helper_binary ("gnunet-nat-server");
     if (GNUNET_NO == nat_res)
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-          "Cannot run NAT test: `%s' %s \n",
-          "gnunet-nat-server",
-           "SUID not set");
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Cannot run NAT test: `%s' %s \n",
+                  "gnunet-nat-server", "SUID not set");
       return 0;
     }
-    if (GNUNET_SYSERR ==  nat_res)
+    if (GNUNET_SYSERR == nat_res)
     {
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-          "Cannot run NAT test: `%s' %s \n",
-          "gnunet-nat-server",
-          "file not found");
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Cannot run NAT test: `%s' %s \n",
+                  "gnunet-nat-server", "file not found");
       return 0;
     }
   }