gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r13034 - gnunet/src/testing
Date: Mon, 20 Sep 2010 15:00:38 +0200

Author: nevans
Date: 2010-09-20 15:00:38 +0200 (Mon, 20 Sep 2010)
New Revision: 13034

Modified:
   gnunet/src/testing/testing_group.c
Log:
fix for remote testing

Modified: gnunet/src/testing/testing_group.c
===================================================================
--- gnunet/src/testing/testing_group.c  2010-09-20 11:23:43 UTC (rev 13033)
+++ gnunet/src/testing/testing_group.c  2010-09-20 13:00:38 UTC (rev 13034)
@@ -365,7 +365,7 @@
 
 
 /**
- * Data we keep per host.
+ * Linked list of per-host data.
  */
 struct HostData
 {
@@ -509,12 +509,16 @@
   void *notify_connection_cls;
 
   /**
-   * NULL-terminated array of information about
-   * hosts.
+   * Array of information about hosts.
    */
   struct HostData *hosts;
 
   /**
+   * Number of hosts (size of HostData)
+   */
+  unsigned int num_hosts;
+
+  /**
    * Array of "total" peers.
    */
   struct PeerData *peers;
@@ -3571,7 +3575,7 @@
   pg->peers = GNUNET_malloc (total * sizeof (struct PeerData));
   if (NULL != hostnames)
     {
-      off = 2;
+      off = 0;
       hostpos = hostnames;
       while (hostpos != NULL)
         {
@@ -3585,21 +3589,21 @@
       while (hostpos != NULL)
         {
           pg->hosts[off].minport = LOW_PORT;
-          off++;
           pg->hosts[off].hostname = GNUNET_strdup(hostpos->hostname);
           if (hostpos->username != NULL)
             pg->hosts[off].username = GNUNET_strdup(hostpos->username);
           pg->hosts[off].sshport = hostpos->port;
           hostpos = hostpos->next;
+          off++;
         }
 
       if (off == 0)
         {
-          GNUNET_free (pg->hosts);
           pg->hosts = NULL;
         }
       hostcnt = off;
       minport = 0;
+      pg->num_hosts = off;
 
 #if NO_LL
       off = 2;
@@ -4279,11 +4283,12 @@
         
GNUNET_CONTAINER_multihashmap_destroy(pg->peers[off].blacklisted_peers);
     }
   GNUNET_free (pg->peers);
-  if (NULL != pg->hosts)
+  for (off = 0; off < pg->num_hosts; off++)
     {
-      GNUNET_free (pg->hosts[0].hostname);
-      GNUNET_free (pg->hosts);
+      GNUNET_free (pg->hosts[off].hostname);
+      GNUNET_free_non_null (pg->hosts[off].username);
     }
+  GNUNET_free_non_null (pg->hosts);
   GNUNET_free (pg);
 }
 




reply via email to

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