gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r12410 - gnunet/src/testing


From: gnunet
Subject: [GNUnet-SVN] r12410 - gnunet/src/testing
Date: Fri, 30 Jul 2010 16:43:10 +0200

Author: nevans
Date: 2010-07-30 16:43:10 +0200 (Fri, 30 Jul 2010)
New Revision: 12410

Modified:
   gnunet/src/testing/testing_group.c
Log:
change from host as char * list to linked list

Modified: gnunet/src/testing/testing_group.c
===================================================================
--- gnunet/src/testing/testing_group.c  2010-07-30 14:41:29 UTC (rev 12409)
+++ gnunet/src/testing/testing_group.c  2010-07-30 14:43:10 UTC (rev 12410)
@@ -2975,8 +2975,8 @@
  * @param cb_cls closure for cb
  * @param connect_callback function to call each time two hosts are connected
  * @param connect_callback_cls closure for connect_callback
- * @param hostnames space-separated list of hostnames to use; can be NULL (to 
run
- *        everything on localhost).
+ * @param hostnames linked list of hosts to use to start peers on (NULL to run 
on localhost only)
+ *
  * @return NULL on error, otherwise handle to control peer group
  */
 struct GNUNET_TESTING_PeerGroup *
@@ -2990,12 +2990,15 @@
                               void *cb_cls,
                               GNUNET_TESTING_NotifyConnection
                               connect_callback, void *connect_callback_cls,
-                              const char *hostnames)
+                              const struct GNUNET_TESTING_Host *hostnames)
 {
   struct GNUNET_TESTING_PeerGroup *pg;
+  const struct GNUNET_TESTING_Host *hostpos;
+#if 0
+  char *pos;
   const char *rpos;
-  char *pos;
   char *start;
+#endif
   const char *hostname;
   char *baseservicehome;
   char *newservicehome;
@@ -3023,6 +3026,33 @@
   if (NULL != hostnames)
     {
       off = 2;
+      hostpos = hostnames;
+      while (hostpos != NULL)
+        {
+          hostpos = hostpos->next;
+          off++;
+        }
+      pg->hosts = GNUNET_malloc (off * sizeof (struct HostData));
+      off = 0;
+
+      hostpos = hostnames;
+      while (hostpos != NULL)
+        {
+          pg->hosts[off].minport = LOW_PORT;
+          pg->hosts[off++].hostname = GNUNET_strdup(hostpos->hostname);
+          hostpos = hostpos->next;
+        }
+
+      if (off == 0)
+        {
+          GNUNET_free (pg->hosts);
+          pg->hosts = NULL;
+        }
+      hostcnt = off;
+      minport = 0;
+
+#if NO_LL
+      off = 2;
       /* skip leading spaces */
       while ((0 != *hostnames) && (isspace ( (unsigned char) *hostnames)))
         hostnames++;
@@ -3064,6 +3094,7 @@
         }
       hostcnt = off;
       minport = 0;              /* make gcc happy */
+#endif
     }
   else
     {




reply via email to

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