gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r9006 - GNUnet/src/applications/testing


From: gnunet
Subject: [GNUnet-SVN] r9006 - GNUnet/src/applications/testing
Date: Thu, 17 Sep 2009 17:30:11 -0600

Author: nevans
Date: 2009-09-17 17:30:09 -0600 (Thu, 17 Sep 2009)
New Revision: 9006

Modified:
   GNUnet/src/applications/testing/remote.c
   GNUnet/src/applications/testing/remote.h
   GNUnet/src/applications/testing/remotetopologies.c
Log:
miscellaneous small improvements

Modified: GNUnet/src/applications/testing/remote.c
===================================================================
--- GNUnet/src/applications/testing/remote.c    2009-09-17 23:28:48 UTC (rev 
9005)
+++ GNUnet/src/applications/testing/remote.c    2009-09-17 23:30:09 UTC (rev 
9006)
@@ -68,7 +68,8 @@
 GNUNET_REMOTE_start_daemon (char *gnunetd_home,
                             char *localConfigPath, char *configFileName,
                             char *remote_config_path, char *hostname,
-                            char *username, char *remote_friend_file_path, 
char *prepend_exec)
+                            char *username, char *remote_friend_file_path,
+                            char *prepend_exec)
 {
   char *cmd;
   int length;
@@ -83,20 +84,21 @@
   if (is_local)
     {
       length =
-        snprintf (NULL, 0, "cp %s%s %s", localConfigPath, configFileName,
-                  remote_config_path);
+        snprintf (NULL, 0, "cp %s%s %s > /dev/null 2>&1", localConfigPath,
+                  configFileName, remote_config_path);
       cmd = GNUNET_malloc (length + 1);
-      GNUNET_snprintf (cmd, length + 1, "cp %s%s %s", localConfigPath,
-                       configFileName, remote_config_path);
+      GNUNET_snprintf (cmd, length + 1, "cp %s%s %s > /dev/null 2>&1",
+                       localConfigPath, configFileName, remote_config_path);
     }
   else
     {
       length =
-        snprintf (NULL, 0, "scp %s%s address@hidden:%s", localConfigPath,
-                  configFileName, username, hostname, remote_config_path);
+        snprintf (NULL, 0, "scp %s%s address@hidden:%s > /dev/null 2>&1",
+                  localConfigPath, configFileName, username, hostname,
+                  remote_config_path);
       cmd = GNUNET_malloc (length + 1);
-      GNUNET_snprintf (cmd, length + 1, "scp %s%s address@hidden:%s", 
localConfigPath,
-                       configFileName, username, hostname,
+      GNUNET_snprintf (cmd, length + 1, "scp %s%s address@hidden:%s > 
/dev/null 2>&1",
+                       localConfigPath, configFileName, username, hostname,
                        remote_config_path);
     }
 
@@ -110,19 +112,22 @@
   if (is_local)
     {
       length =
-        snprintf (NULL, 0, "%sgnunet-update -c %s%s", gnunetd_home,
-                  remote_config_path, configFileName);
+        snprintf (NULL, 0, "%sgnunet-update -c %s%s > /dev/null 2>&1",
+                  gnunetd_home, remote_config_path, configFileName);
       cmd = GNUNET_malloc (length + 1);
-      snprintf (cmd, length + 1, "%sgnunet-update -c %s%s", gnunetd_home,
-                remote_config_path, configFileName);
+      snprintf (cmd, length + 1, "%sgnunet-update -c %s%s > /dev/null 2>&1",
+                gnunetd_home, remote_config_path, configFileName);
     }
   else
     {
       length =
-        snprintf (NULL, 0, "ssh address@hidden %sgnunet-update -c %s%s", 
username,
-                  hostname, gnunetd_home, remote_config_path, configFileName);
+        snprintf (NULL, 0,
+                  "ssh address@hidden %sgnunet-update -c %s%s > /dev/null 
2>&1",
+                  username, hostname, gnunetd_home, remote_config_path,
+                  configFileName);
       cmd = GNUNET_malloc (length + 1);
-      snprintf (cmd, length + 1, "ssh address@hidden %sgnunet-update -c %s%s",
+      snprintf (cmd, length + 1,
+                "ssh address@hidden %sgnunet-update -c %s%s > /dev/null 2>&1",
                 username, hostname, gnunetd_home, remote_config_path,
                 configFileName);
     }
@@ -136,20 +141,25 @@
   if (is_local)
     {
       length =
-        snprintf (NULL, 0, "%s %sgnunetd -c %s%s &", prepend_exec,
-                  gnunetd_home, remote_config_path, configFileName);
+        snprintf (NULL, 0, "%s %sgnunetd -c %s%s > /dev/null 2>&1 &",
+                  prepend_exec, gnunetd_home, remote_config_path,
+                  configFileName);
       cmd = GNUNET_malloc (length + 1);
-      snprintf (cmd, length + 1, "%s %sgnunetd -c %s%s &", prepend_exec, 
gnunetd_home,
-                remote_config_path, configFileName);
+      snprintf (cmd, length + 1, "%s %sgnunetd -c %s%s 2>&1 > /dev/null &",
+                prepend_exec, gnunetd_home, remote_config_path,
+                configFileName);
     }
   else
     {
       length =
-        snprintf (NULL, 0, "ssh address@hidden %s %sgnunetd -c %s%s &", 
username,
-                  hostname, prepend_exec, gnunetd_home, remote_config_path, 
configFileName);
+        snprintf (NULL, 0,
+                  "ssh address@hidden %s %sgnunetd -c %s%s > /dev/null 2>&1 &",
+                  username, hostname, prepend_exec, gnunetd_home,
+                  remote_config_path, configFileName);
       cmd = GNUNET_malloc (length + 1);
-      snprintf (cmd, length + 1, "ssh address@hidden %s %sgnunetd -c %s%s &",
-                username, hostname, prepend_exec, gnunetd_home, 
remote_config_path,
+      snprintf (cmd, length + 1,
+                "ssh address@hidden %s %sgnunetd -c %s%s > /dev/null 2>&1 &", 
username,
+                hostname, prepend_exec, gnunetd_home, remote_config_path,
                 configFileName);
 
     }
@@ -358,6 +368,8 @@
   unsigned long long num_machines;
   unsigned int i;
   unsigned int j;
+  unsigned int modnum;
+  unsigned int dotnum;
   unsigned int pos;
   unsigned short malicious_mask;
   int temp_remote_config_path_length;
@@ -397,7 +409,7 @@
                                             &malicious_getters);
 
   if (malicious_getters > 0)
-    malicious_getter_num = (int)(number_of_daemons / malicious_getters);
+    malicious_getter_num = (int) (number_of_daemons / malicious_getters);
   else
     malicious_getter_num = 0;
 
@@ -407,7 +419,7 @@
                                             &malicious_putters);
 
   if (malicious_putters > 0)
-    malicious_putter_num = (int)(number_of_daemons / malicious_putters);
+    malicious_putter_num = (int) (number_of_daemons / malicious_putters);
   else
     malicious_putter_num = 0;
 
@@ -417,7 +429,7 @@
                                             &malicious_droppers);
 
   if (malicious_droppers > 0)
-    malicious_dropper_num = (int)(number_of_daemons / malicious_droppers);
+    malicious_dropper_num = (int) (number_of_daemons / malicious_droppers);
   else
     malicious_dropper_num = 0;
 
@@ -544,7 +556,11 @@
 #endif
   i = 0;
   count_started = 0;
+  modnum = number_of_daemons / 4;
+  dotnum = number_of_daemons / 50;
   pos = length;
+  fprintf (stdout, "Daemon start progress: [");
+  fflush (stdout);
   while (i < num_machines)
     {
       basecfg = GNUNET_GC_create ();
@@ -771,8 +787,9 @@
               GNUNET_REMOTE_start_daemon (remote_gnunetd_path, "/tmp/",
                                           temp, remote_config_path,
                                           curr_host, ssh_username,
-                                          temp_pos->remote_friend_file_path, 
prepend_exec);
-
+                                          temp_pos->remote_friend_file_path,
+                                          prepend_exec);
+              GNUNET_thread_sleep (500 * GNUNET_CRON_MILLISECONDS);
               next_peer =
                 GNUNET_malloc (sizeof
                                (struct GNUNET_REMOTE_TESTING_DaemonContext));
@@ -808,6 +825,21 @@
                                                       next_peer->port);
               head = temp_pos;
               array_of_pointers[count_started] = temp_pos;
+              if (count_started % modnum == 0)
+                {
+                  if (count_started == 0)
+                    fprintf (stdout, "0%%");
+                  else
+                    fprintf (stdout, "%d%%",
+                             (int) (((float) (count_started + 1) /
+                                     number_of_daemons) * 100));
+
+                }
+              else if (count_started % dotnum == 0)
+                {
+                  fprintf (stdout, ".");
+                }
+              fflush (stdout);
               count_started++;
             }
           GNUNET_free (temp_pid_file);
@@ -1056,8 +1088,9 @@
                                               temp, remote_config_path,
                                               curr_host, ssh_username,
                                               temp_pos->
-                                              remote_friend_file_path, 
prepend_exec);
-
+                                              remote_friend_file_path,
+                                              prepend_exec);
+                  GNUNET_thread_sleep (500 * GNUNET_CRON_MILLISECONDS);
                   next_peer =
                     GNUNET_malloc (sizeof
                                    (struct
@@ -1095,6 +1128,21 @@
                                                           next_peer->port);
                   head = temp_pos;
                   array_of_pointers[count_started] = temp_pos;
+                  if (count_started % modnum == 0)
+                    {
+                      if (count_started == 0)
+                        fprintf (stdout, "0%%");
+                      else
+                        fprintf (stdout, "%d%%",
+                                 (int) (((float) (count_started + 1) /
+                                         number_of_daemons) * 100));
+
+                    }
+                  else if (count_started % dotnum == 0)
+                    {
+                      fprintf (stdout, ".");
+                    }
+                  fflush (stdout);
                   count_started++;
                 }
 
@@ -1106,10 +1154,12 @@
               GNUNET_free (temp);
             }
         }
-
       GNUNET_GC_free (basecfg);
       ++i;
     }
+
+  fprintf (stdout, "%d%%]\n",
+           (int) (((float) count_started / number_of_daemons) * 100));
   ret =
     GNUNET_REMOTE_create_topology (type_of_topology, number_of_daemons,
                                    dotOutFile, percentage, logNModifier);
@@ -1280,8 +1330,12 @@
   int tempThreadCount;
   int i;
   int j;
+  unsigned int totalConnections;
+  unsigned int totalConnectAttempts;
+  unsigned int totalCreatedConnections;
   unsigned int *daemon_list;
-
+  unsigned int modnum;
+  unsigned int dotnum;
   void *unusedVoid;
   globalDotFile = dotOutFile;
   ret = GNUNET_OK;
@@ -1292,47 +1346,42 @@
   switch (type)
     {
     case GNUNET_REMOTE_CLIQUE:
-#if VERBOSE
-      fprintf (stderr, _("Creating clique topology\n"));
-#endif
-      ret = GNUNET_REMOTE_connect_clique (head, dotOutFile);
+      fprintf (stderr, _("Creating clique topology (may take a bit!)\n"));
+      ret =
+        GNUNET_REMOTE_connect_clique (&totalConnections, head, dotOutFile);
       break;
     case GNUNET_REMOTE_SMALL_WORLD:
-#if VERBOSE
-      fprintf (stderr, _("Creating small world topology\n"));
-#endif
+      fprintf (stderr,
+               _("Creating small world topology (may take a bit!)\n"));
       ret =
-        GNUNET_REMOTE_connect_small_world_ring (number_of_daemons,
+        GNUNET_REMOTE_connect_small_world_ring (&totalConnections,
+                                                number_of_daemons,
                                                 list_as_array, dotOutFile,
                                                 percentage, logNModifier);
       break;
     case GNUNET_REMOTE_RING:
-#if VERBOSE
-      fprintf (stderr, _("Creating ring topology\n"));
-#endif
-      ret = GNUNET_REMOTE_connect_ring (head, dotOutFile);
+      fprintf (stderr, _("Creating ring topology (may take a bit!)\n"));
+      ret = GNUNET_REMOTE_connect_ring (&totalConnections, head, dotOutFile);
       break;
     case GNUNET_REMOTE_2D_TORUS:
-#if VERBOSE
-      fprintf (stderr, _("Creating 2d torus topology\n"));
-#endif
+      fprintf (stderr, _("Creating 2d torus topology (may take a bit!)\n"));
       ret =
-        GNUNET_REMOTE_connect_2d_torus (number_of_daemons, list_as_array,
-                                        dotOutFile);
+        GNUNET_REMOTE_connect_2d_torus (&totalConnections, number_of_daemons,
+                                        list_as_array, dotOutFile);
       break;
     case GNUNET_REMOTE_ERDOS_RENYI:
-#if VERBOSE
-      fprintf (stderr, _("Creating Erdos-Renyi topology\n"));
-#endif
-      ret = GNUNET_REMOTE_connect_erdos_renyi (percentage, head, dotOutFile);
+      fprintf (stderr,
+               _("Creating Erdos-Renyi topology (may take a bit!)\n"));
+      ret =
+        GNUNET_REMOTE_connect_erdos_renyi (&totalConnections, percentage,
+                                           head, dotOutFile);
       break;
     case GNUNET_REMOTE_INTERNAT:
-#if VERBOSE
-      fprintf (stderr, _("Creating InterNAT topology\n"));
-#endif
+      fprintf (stderr, _("Creating InterNAT topology (may take a bit!)\n"));
       ret =
-        GNUNET_REMOTE_connect_nated_internet (percentage, number_of_daemons,
-                                              head, dotOutFile);
+        GNUNET_REMOTE_connect_nated_internet (&totalConnections, percentage,
+                                              number_of_daemons, head,
+                                              dotOutFile);
       break;
     case GNUNET_REMOTE_NONE:
       GNUNET_free (daemon_list);
@@ -1342,10 +1391,15 @@
       ret = GNUNET_SYSERR;
       break;
     }
-  totalConnections = 0;
+  totalCreatedConnections = 0;
+  totalConnectAttempts = 0;
+  modnum = totalConnections / 4;
+  dotnum = totalConnections / 50;
+
   if (ret == GNUNET_OK)
     {
       pos = head;
+      fprintf (stdout, "Friend file creation progress: \[");
       while (pos != NULL)
         {
           /* Printing out the friends isn't necessary, but it's nice */
@@ -1363,28 +1417,44 @@
               fprintf (temp_friend_handle, "%s\n",
                        (const char *) friend_pos->nodeid);
               friend_pos = friend_pos->next;
-              totalConnections++;
+
+              if (totalCreatedConnections % modnum == 0)
+                {
+                  if (totalCreatedConnections == 0)
+                    fprintf (stdout, "0%%");
+                  else
+                    fprintf (stdout, "%d%%",
+                             (int) (((float) totalCreatedConnections /
+                                     totalConnections) * 100));
+
+                }
+              else if (totalCreatedConnections % dotnum == 0)
+                {
+                  fprintf (stdout, ".");
+                }
+              fflush (stdout);
+              totalCreatedConnections++;
             }
 
           fclose (temp_friend_handle);
           if (strcmp (pos->hostname, "localhost") == 0)
             {
               length =
-                snprintf (NULL, 0, "cp %s %s", "friend.temp",
+                snprintf (NULL, 0, "cp %s %s > /dev/null 2>&1", "friend.temp",
                           pos->remote_friend_file_path);
               cmd = GNUNET_malloc (length + 1);
-              snprintf (cmd, length + 1, "cp %s %s", "friend.temp",
-                        pos->remote_friend_file_path);
+              snprintf (cmd, length + 1, "cp %s %s > /dev/null 2>&1",
+                        "friend.temp", pos->remote_friend_file_path);
             }
           else
             {
               length =
-                snprintf (NULL, 0, "scp %s address@hidden:%s", "friend.temp",
-                          pos->username, pos->hostname,
+                snprintf (NULL, 0, "scp %s address@hidden:%s > /dev/null 2>&1",
+                          "friend.temp", pos->username, pos->hostname,
                           pos->remote_friend_file_path);
               cmd = GNUNET_malloc (length + 1);
-              snprintf (cmd, length + 1, "scp %s address@hidden:%s", 
"friend.temp",
-                        pos->username, pos->hostname,
+              snprintf (cmd, length + 1, "scp %s address@hidden:%s > /dev/null 
2>&1",
+                        "friend.temp", pos->username, pos->hostname,
                         pos->remote_friend_file_path);
             }
 #if VERBOSE
@@ -1395,28 +1465,18 @@
           GNUNET_free (cmd);
           pos = pos->next;
         }
-
+      fprintf (stdout, "%d%%]\n",
+               (int) (((float) totalCreatedConnections / totalConnections) *
+                      100));
       unused = system ("rm friend.temp");
-
       pos = head;
 
-      /* This loop goes over the friend entries of each peer and connects that
-       * peer to each friend in the list.  Note this is redundant, i.e. once
-       * the two are connected, the second doesn't really need to try to 
connect
-       * to the first later, but this IS simple.  If performance becomes a 
problem
-       * with MANY conns, we'll see...
-       *
-       * 8-2009 - it is now a problem (-:  Options:
-       *  1. Use hashmap and list of previously connected peers (cuts down 
number of attempts by half)
-       *  2. Use multiple threads for connecting.  Start X threads, one per 
peer with max of Y and connect that peers friends.
-       *  3. Combine both of these ideas into new fun way of doing stuff.
-       *
-       *  Okay, Combined both solutions for a fix... Just need to test on large
-       *  scale testbed (lab) to confirm it actually helps.
-       */
       connectMutex = GNUNET_mutex_create (GNUNET_YES);
       connectFailures = 0;
       tempThreadCount = 0;
+      modnum = number_of_daemons / 4;
+      dotnum = number_of_daemons / 50;
+      fprintf (stdout, "Friend connection progress: \[");
       for (j = 0; j < number_of_daemons; j++)
         {
           if (tempThreadCount >= MAX_CONNECT_THREADS)
@@ -1427,7 +1487,6 @@
                   fprintf (stdout, "Joining thread %d...\n", i);
 #endif
                   GNUNET_thread_join (threads[i], &unusedVoid);
-
                 }
               tempThreadCount = 0;
             }
@@ -1438,9 +1497,26 @@
             GNUNET_thread_create (&connect_peer_thread,
                                   list_as_array[daemon_list[j]], 1024 * 16);
           tempThreadCount++;
+          if (totalConnectAttempts % modnum == 0)
+            {
+              if (totalConnectAttempts == 0)
+                fprintf (stdout, "0%%");
+              else
+                fprintf (stdout, "%d%%",
+                         (int) (((float) totalConnectAttempts /
+                                 number_of_daemons) * 100));
 
+            }
+          else if (totalConnectAttempts % dotnum == 0)
+            {
+              fprintf (stdout, ".");
+            }
+          fflush (stdout);
+          totalConnectAttempts++;
         }
-
+      fprintf (stdout, "%d%%]\n",
+               (int) (((float) totalConnectAttempts / number_of_daemons) *
+                      100));
       GNUNET_thread_sleep (2000 * GNUNET_CRON_MILLISECONDS);
       for (i = 0; i < tempThreadCount; i++)
         {
@@ -1461,7 +1537,7 @@
     }
 
 #if VERBOSE
-  fprintf (stderr, _("Total connections: %d!\n"), totalConnections);
+  fprintf (stderr, _("Total connections: %d!\n"), totalCreatedConnections);
   fprintf (stderr, _("Total failed connections: %d!\n"), connectFailures);
 #endif
 
@@ -1471,7 +1547,7 @@
   else
     {
       GNUNET_free (daemon_list);
-      return totalConnections;
+      return totalCreatedConnections;
     }
 }
 

Modified: GNUnet/src/applications/testing/remote.h
===================================================================
--- GNUnet/src/applications/testing/remote.h    2009-09-17 23:28:48 UTC (rev 
9005)
+++ GNUnet/src/applications/testing/remote.h    2009-09-17 23:30:09 UTC (rev 
9006)
@@ -33,7 +33,7 @@
 #include "gnunet_util.h"
 #include "gnunet_remote_lib.h"
 
-#define VERBOSE GNUNET_YES
+#define VERBOSE GNUNET_NO
 
 /**
  * Linked list of information about daemon processes.

Modified: GNUnet/src/applications/testing/remotetopologies.c
===================================================================
--- GNUnet/src/applications/testing/remotetopologies.c  2009-09-17 23:28:48 UTC 
(rev 9005)
+++ GNUnet/src/applications/testing/remotetopologies.c  2009-09-17 23:30:09 UTC 
(rev 9006)
@@ -105,7 +105,8 @@
 }
 
 int
-GNUNET_REMOTE_connect_nated_internet (double nat_percentage,
+GNUNET_REMOTE_connect_nated_internet (unsigned int *totalConnections,
+                                      double nat_percentage,
                                       int number_of_daemons,
                                       struct GNUNET_REMOTE_host_list
                                       *main_list, FILE * dotOutFile)
@@ -156,7 +157,8 @@
 
 
 int
-GNUNET_REMOTE_connect_erdos_renyi (double probability,
+GNUNET_REMOTE_connect_erdos_renyi (unsigned int *totalConnections,
+                                   double probability,
                                    struct GNUNET_REMOTE_host_list *main_list,
                                    FILE * dotOutFile)
 {
@@ -188,7 +190,8 @@
 }
 
 int
-GNUNET_REMOTE_connect_clique (struct GNUNET_REMOTE_host_list *main_list,
+GNUNET_REMOTE_connect_clique (unsigned int *totalConnections,
+                              struct GNUNET_REMOTE_host_list *main_list,
                               FILE * dotOutFile)
 {
   struct GNUNET_REMOTE_host_list *pos = main_list;
@@ -209,7 +212,8 @@
 }
 
 int
-GNUNET_REMOTE_connect_ring (struct GNUNET_REMOTE_host_list *main_list,
+GNUNET_REMOTE_connect_ring (unsigned int *totalConnections,
+                            struct GNUNET_REMOTE_host_list *main_list,
                             FILE * dotOutFile)
 {
   struct GNUNET_REMOTE_host_list *pos = main_list;
@@ -228,7 +232,8 @@
 }
 
 int
-GNUNET_REMOTE_connect_2d_torus (unsigned int number_of_daemons,
+GNUNET_REMOTE_connect_2d_torus (unsigned int *totalConnections,
+                                unsigned int number_of_daemons,
                                 struct GNUNET_REMOTE_host_list
                                 **list_as_array, FILE * dotOutFile)
 {
@@ -300,7 +305,8 @@
 }
 
 int
-GNUNET_REMOTE_connect_small_world (unsigned int number_of_daemons,
+GNUNET_REMOTE_connect_small_world (unsigned int *totalConnections,
+                                   unsigned int number_of_daemons,
                                    struct GNUNET_REMOTE_host_list
                                    **list_as_array, FILE * dotOutFile,
                                    double percentage)
@@ -318,7 +324,7 @@
   unsigned int node2Col;
   unsigned int distance;
   double probability, random;
-  unsigned int totalConnections, smallWorldConnections;
+  unsigned int smallWorldConnections;
 
   square = floor (sqrt (number_of_daemons));
   rows = square;
@@ -342,7 +348,7 @@
            rows, cols);
 #endif
 
-  totalConnections = 0;
+  *totalConnections = 0;
   /* Rows and columns are all sorted out, now iterate over all nodes and 
connect each
    * to the node to its right and above.  Once this is over, we'll have our 
torus!
    * Special case for the last node (if the rows and columns are not equal), 
connect
@@ -360,8 +366,8 @@
 #if VERBOSE
       fprintf (stderr, _("connecting node %u to %u\n"), i, nodeToConnect);
 #endif
-      totalConnections += addNodeRefs (list_as_array[i],
-                                       list_as_array[nodeToConnect]);
+      *totalConnections += addNodeRefs (list_as_array[i],
+                                        list_as_array[nodeToConnect]);
 
       if (i < cols)
         nodeToConnect = (rows * cols) - cols + i;
@@ -373,8 +379,8 @@
 #if VERBOSE
           fprintf (stderr, _("connecting node %u to %u\n"), i, nodeToConnect);
 #endif
-          totalConnections += addNodeRefs (list_as_array[i],
-                                           list_as_array[nodeToConnect]);
+          *totalConnections += addNodeRefs (list_as_array[i],
+                                            list_as_array[nodeToConnect]);
         }
 
     }
@@ -383,8 +389,8 @@
 #if VERBOSE
   fprintf (stderr, _("natural log of %d is %d, will run %d iterations\n"),
            number_of_daemons, natLog, (int) (natLog * percentage));
-  fprintf (stderr, _("Total connections added thus far: %d!\n"),
-           totalConnections);
+  fprintf (stderr, _("Total connections added thus far: %u!\n"),
+           *totalConnections);
 #endif
   smallWorldConnections = 0;
   for (i = 0; i < (int) (natLog * percentage); i++)
@@ -418,7 +424,7 @@
             }
         }
     }
-  totalConnections += smallWorldConnections;
+  *totalConnections += smallWorldConnections;
 #if VERBOSE
   fprintf (stderr, _("Total connections added for small world: %d!\n"),
            smallWorldConnections);
@@ -428,7 +434,8 @@
 }
 
 int
-GNUNET_REMOTE_connect_small_world_ring (unsigned int number_of_daemons,
+GNUNET_REMOTE_connect_small_world_ring (unsigned int *totalConnections,
+                                        unsigned int number_of_daemons,
                                         struct GNUNET_REMOTE_host_list
                                         **list_as_array, FILE * dotOutFile,
                                         double percentage,
@@ -439,7 +446,7 @@
   unsigned int natLog;
   unsigned int randomPeer;
   double random;
-  unsigned int totalConnections, smallWorldConnections;
+  unsigned int smallWorldConnections;
   int connsPerPeer;
   natLog = log (number_of_daemons);
   connsPerPeer = ceil (natLog * logNModifier);
@@ -452,7 +459,7 @@
 
   srand ((unsigned int) GNUNET_get_time ());
   smallWorldConnections = 0;
-  totalConnections = 0;
+  *totalConnections = 0;
   for (i = 0; i < number_of_daemons; i++)
     {
       useAnd = 0;
@@ -518,18 +525,18 @@
               fprintf (stderr, _("connecting node %u to %u\n"), i,
                        nodeToConnect);
 #endif
-              totalConnections +=
+              *totalConnections +=
                 addNodeRefs (list_as_array[i], list_as_array[nodeToConnect]);
             }
         }
 
     }
 
-  totalConnections += smallWorldConnections;
+  *totalConnections += smallWorldConnections;
 #if VERBOSE
   fprintf (stderr, _("Total connections added for small world: %d!\n"),
            smallWorldConnections);
-  fprintf (stderr, _("Total connections: %d!\n"), totalConnections);
+  fprintf (stderr, _("Total connections: %d!\n"), *totalConnections);
 #endif
 
   return GNUNET_OK;
@@ -607,7 +614,6 @@
                                                       h2)) &&
               (GNUNET_OK == GNUNET_IDENTITY_peer_add (sock2, h1)))
             {
-              fprintf (stderr, ".");
               if (GNUNET_YES == GNUNET_IDENTITY_request_connect (sock1,
                                                                  &h2->
                                                                  
senderIdentity))





reply via email to

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