gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r24846 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r24846 - gnunet/src/transport
Date: Thu, 8 Nov 2012 16:04:27 +0100

Author: wachs
Date: 2012-11-08 16:04:27 +0100 (Thu, 08 Nov 2012)
New Revision: 24846

Modified:
   gnunet/src/transport/gnunet-transport.c
Log:
fixed -b semantics: receive from all peers

Modified: gnunet/src/transport/gnunet-transport.c
===================================================================
--- gnunet/src/transport/gnunet-transport.c     2012-11-08 14:57:32 UTC (rev 
24845)
+++ gnunet/src/transport/gnunet-transport.c     2012-11-08 15:04:27 UTC (rev 
24846)
@@ -510,20 +510,6 @@
       GNUNET_break (0);
     return;
   }
-  if (benchmark_receive)
-  {
-      if (verbosity > 0)
-        FPRINTF (stdout, _("Successfully connected to `%s', starting to 
receive benchmark data\n"),
-            GNUNET_i2s (&pid));
-      if (GNUNET_SCHEDULER_NO_TASK != op_timeout)
-      {
-        GNUNET_SCHEDULER_cancel (op_timeout);
-        op_timeout = GNUNET_SCHEDULER_NO_TASK;
-      }
-
-      start_time = GNUNET_TIME_absolute_get ();
-      return;
-  }
 }
 
 
@@ -622,16 +608,10 @@
   {
     if (GNUNET_MESSAGE_TYPE_DUMMY != ntohs (message->type))
       return;
+    if (verbosity > 0)
+      FPRINTF (stdout, _("Received %u bytes from %s\n"),
+               (unsigned int) ntohs (message->size), GNUNET_i2s (peer));
 
-    if (0 == memcmp (&pid, peer, sizeof (struct GNUNET_PeerIdentity)))
-    {
-      if (verbosity > 0)
-        FPRINTF (stdout, _("Received %u bytes from %s\n"),
-                 (unsigned int) ntohs (message->size), GNUNET_i2s (peer));
-    }
-    else
-        /* Received data from other peer*/ return;
-
     if (traffic_received == 0)
       start_time = GNUNET_TIME_absolute_get ();
     traffic_received += ntohs (message->size);
@@ -753,7 +733,7 @@
     return;
   }
 
-  if (try_connect)
+  if (try_connect) /* -C: Connect to peer */
   {
     if (NULL == cpid)
     {
@@ -777,7 +757,7 @@
                                                &operation_timeout, NULL);
 
   }
-  else if (benchmark_send) /* Benchmark sending */
+  else if (benchmark_send) /* -s: Benchmark sending */
   {
     if (NULL == cpid)
     {
@@ -801,28 +781,21 @@
     op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT,
                                                &operation_timeout, NULL);
   }
-  else if (benchmark_receive) /* Benchmark receiving */
+  else if (benchmark_receive) /* -b: Benchmark receiving */
   {
-    if (NULL == cpid)
-    {
-      FPRINTF (stderr, _("Option `%s' makes no sense without option `%s'.\n"),
-               "-b", "-p");
-      ret = 1;
-      return;
-    }
     handle =
         GNUNET_TRANSPORT_connect (cfg, NULL, NULL, &notify_receive,
-                                  &notify_connect, &notify_disconnect);
+                                  NULL, NULL);
     if (NULL == handle)
     {
         FPRINTF (stderr, _("Failed to connect to transport service\n"));
         ret = 1;
         return;
     }
-    GNUNET_TRANSPORT_try_connect (handle, &pid);
+    if (verbosity > 0)
+      FPRINTF (stdout, _("Starting to receive benchmark data\n"));
     start_time = GNUNET_TIME_absolute_get ();
-    op_timeout = GNUNET_SCHEDULER_add_delayed (OP_TIMEOUT,
-                                               &operation_timeout, NULL);
+
   }
   else if (iterate_connections) /* -i: List all active addresses once */
   {
@@ -900,7 +873,7 @@
   int res;
   static const struct GNUNET_GETOPT_CommandLineOption options[] = {
     {'b', "benchmark", NULL,
-     gettext_noop ("measure how fast we are receiving data (until CTRL-C)"),
+     gettext_noop ("measure how fast we are receiving data from all peers 
(until CTRL-C)"),
      0, &GNUNET_GETOPT_set_one, &benchmark_receive},
     {'C', "connect", NULL,
      gettext_noop ("connect to a peer"),




reply via email to

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