gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r8839 - GNUnet/src/applications/testing
Date: Thu, 20 Aug 2009 15:55:22 -0600

Author: nevans
Date: 2009-08-20 15:55:22 -0600 (Thu, 20 Aug 2009)
New Revision: 8839

Modified:
   GNUnet/src/applications/testing/remote.c
Log:
trying randomized peers to spread connection load

Modified: GNUnet/src/applications/testing/remote.c
===================================================================
--- GNUnet/src/applications/testing/remote.c    2009-08-20 18:01:25 UTC (rev 
8838)
+++ GNUnet/src/applications/testing/remote.c    2009-08-20 21:55:22 UTC (rev 
8839)
@@ -1218,12 +1218,15 @@
   int length;
   int tempThreadCount;
   int i;
+  int j;
+  unsigned int *daemon_list;
 
   void *unusedVoid;
   globalDotFile = dotOutFile;
   ret = GNUNET_OK;
   connected = GNUNET_multi_hash_map_create (number_of_daemons * 3);
 
+  daemon_list = GNUNET_permute(GNUNET_RANDOM_QUALITY_WEAK, number_of_daemons);
   switch (type)
     {
     case GNUNET_REMOTE_CLIQUE:
@@ -1350,7 +1353,7 @@
       connectMutex = GNUNET_mutex_create (GNUNET_YES);
       connectFailures = 0;
       tempThreadCount = 0;
-      while ((pos != NULL) && (ret == GNUNET_OK))
+      for(j = 0; j < number_of_daemons; j++)
         {
           if (tempThreadCount > MAX_CONNECT_THREADS)
             {
@@ -1368,16 +1371,18 @@
           fprintf (stdout, "Creating real thread %d...\n", tempThreadCount);
 #endif
           threads[tempThreadCount] =
-            GNUNET_thread_create (&connect_peer_thread, pos, 1024 * 4);
+            GNUNET_thread_create (&connect_peer_thread, 
list_as_array[daemon_list[j]], 1024 * 16);
           tempThreadCount++;
-          pos = pos->next;
+
         }
 
+      GNUNET_thread_sleep(2000 * GNUNET_CRON_MILLISECONDS);
       for (i = 0; i < tempThreadCount; i++)
         {
 #if VERBOSE
           fprintf (stdout, "Joining thread %d...\n", i);
 #endif
+          GNUNET_thread_stop_sleep(threads[i]);
           GNUNET_thread_join (threads[i], &unusedVoid);
 
         }





reply via email to

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