gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r14607 - gnunet/src/testing
Date: Mon, 7 Mar 2011 11:47:42 +0100

Author: nevans
Date: 2011-03-07 11:47:42 +0100 (Mon, 07 Mar 2011)
New Revision: 14607

Modified:
   gnunet/src/testing/testing.c
   gnunet/src/testing/testing_group.c
Log:
create nested directory structure for greater than 32k peers

Modified: gnunet/src/testing/testing.c
===================================================================
--- gnunet/src/testing/testing.c        2011-03-07 10:41:00 UTC (rev 14606)
+++ gnunet/src/testing/testing.c        2011-03-07 10:47:42 UTC (rev 14607)
@@ -39,6 +39,7 @@
 
 #define DEBUG_TESTING GNUNET_NO
 #define DEBUG_TESTING_RECONNECT GNUNET_YES
+#define WAIT_FOR_HELLO GNUNET_NO
 
 /**
  * How long do we wait after starting gnunet-service-arm
@@ -116,13 +117,16 @@
     }
   daemon->phase = SP_START_DONE;
 
+#if WAIT_FOR_HELLO
   if (NULL != cb) /* FIXME: what happens when this callback calls 
GNUNET_TESTING_daemon_stop? */
     cb (daemon->cb_cls, &daemon->id, daemon->cfg, daemon, NULL);
+#endif
 }
 
 static void
 start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
 
+#if WAIT_FOR_HELLO
 /**
  * Function called after GNUNET_CORE_connect has succeeded
  * (or failed for good).  Note that the private key of the
@@ -163,7 +167,7 @@
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Successfully started peer `%4s'.\n", GNUNET_i2s (my_identity));
 #endif
-  d->id = *my_identity;
+  d->id = *my_identity; /* FIXME: shouldn't we already have this from reading 
the hostkey file? */
   if (d->shortname == NULL)
     d->shortname = strdup (GNUNET_i2s (my_identity));
   d->server = server;
@@ -210,8 +214,8 @@
     = GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_EXEC_WAIT,
                                     &start_fsm, d);
 }
+#endif
 
-
 /**
  * Finite-state machine for starting GNUnet.
  *
@@ -618,6 +622,7 @@
       if (d->server != NULL)
         GNUNET_CORE_disconnect(d->server);
 
+#if WAIT_FOR_HELLO
       if (GNUNET_TIME_absolute_get_remaining (d->max_timeout).rel_value ==
           0)
         {
@@ -645,6 +650,34 @@
       d->task
         = GNUNET_SCHEDULER_add_delayed 
(GNUNET_TIME_relative_multiply(GNUNET_CONSTANTS_SERVICE_RETRY, 2),
                                         &start_fsm, d);
+#else
+      d->th = GNUNET_TRANSPORT_connect (d->cfg, &d->id, d, NULL, NULL, NULL);
+      if (d->th == NULL)
+        {
+          if (GNUNET_YES == d->dead)
+            GNUNET_TESTING_daemon_stop (d,
+                                        GNUNET_TIME_absolute_get_remaining
+                                        (d->max_timeout), d->dead_cb,
+                                        d->dead_cb_cls, GNUNET_YES, GNUNET_NO);
+          else if (NULL != d->cb)
+            d->cb (d->cb_cls, &d->id, d->cfg, d,
+                   _("Failed to connect to transport service!\n"));
+          return;
+        }
+    #if DEBUG_TESTING
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Connected to transport service `%s', getting HELLO\n",
+                  GNUNET_i2s (my_identity));
+    #endif
+
+      GNUNET_TRANSPORT_get_hello (d->th, &process_hello, d);
+      cb = d->cb;
+      d->cb = NULL;
+      if (NULL != cb) /* FIXME: what happens when this callback calls 
GNUNET_TESTING_daemon_stop? */
+        cb (d->cb_cls, &d->id, d->cfg, d, NULL);
+      d->running = GNUNET_YES;
+      d->phase = SP_GET_HELLO;
+#endif
       break;
     case SP_GET_HELLO:
       if (GNUNET_TIME_absolute_get_remaining (d->max_timeout).rel_value ==
@@ -1945,6 +1978,7 @@
       if (NULL != cb)
         cb (cb_cls, &d1->id, &d2->id, 0, d1->cfg, d2->cfg, d1, d2,
             _("Peers are not fully running yet, can not connect!\n"));
+      GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Peers are not up!\n");
       return;
     }
 

Modified: gnunet/src/testing/testing_group.c
===================================================================
--- gnunet/src/testing/testing_group.c  2011-03-07 10:41:00 UTC (rev 14606)
+++ gnunet/src/testing/testing_group.c  2011-03-07 10:47:42 UTC (rev 14607)
@@ -32,7 +32,7 @@
 
 #define VERBOSE_TESTING GNUNET_NO
 
-#define VERBOSE_TOPOLOGY GNUNET_YES
+#define VERBOSE_TOPOLOGY GNUNET_NO
 
 #define DEBUG_CHURN GNUNET_NO
 
@@ -5704,6 +5704,7 @@
   struct GNUNET_DISK_FileHandle *fd;
   struct GNUNET_CONFIGURATION_Handle *pcfg;
   unsigned int off;
+  struct OutstandingSSH *ssh_entry;
   unsigned int hostcnt;
   unsigned int i;
   uint16_t minport;
@@ -5816,13 +5817,13 @@
 
   /* Create the servicehome directory for each remote peer */
   GNUNET_assert(GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, 
"PATHS", "SERVICEHOME",
-          &baseservicehome));
+                                                                    
&baseservicehome));
   for (i = 0; i < pg->num_hosts; i++)
     {
-      struct OutstandingSSH *ssh_entry;
       ssh_entry = GNUNET_malloc(sizeof(struct OutstandingSSH));
       ssh_entry->hostname = pg->hosts[i].hostname; /* Don't free! */
       GNUNET_CONTAINER_DLL_insert(pg->ssh_head, pg->ssh_tail, ssh_entry);
+      GNUNET_asprintf(&tmpdir, "%s/%s", baseservicehome, 
pg->hosts[i].hostname);
       if (NULL != pg->hosts[i].username)
         GNUNET_asprintf (&arg, "address@hidden", pg->hosts[i].username,
                          pg->hosts[i].hostname);
@@ -5836,15 +5837,16 @@
 #if !DEBUG_TESTING
                                           "-q",
 #endif
-                                          arg, "mkdir -p", baseservicehome,
+                                          arg, "mkdir -p", tmpdir,
                                           NULL);
         }
       else
         proc = GNUNET_OS_start_process (NULL, NULL, "ssh", "ssh", arg,
-                                        "mkdir -p", baseservicehome, NULL);
+                                        "mkdir -p", tmpdir, NULL);
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Creating remote dir with command ssh %s %s %s\n", arg,
-                  " mkdir -p ", baseservicehome);
+                  " mkdir -p ", tmpdir);
+      GNUNET_free(tmpdir);
       GNUNET_free(arg);
       GNUNET_OS_process_wait (proc);
       GNUNET_OS_process_close(proc);
@@ -5927,15 +5929,22 @@
                                                     "SERVICEHOME",
                                                     &baseservicehome))
         {
-          GNUNET_asprintf (&newservicehome, "%s/%d/", baseservicehome, off);
+          if (hostname != NULL)
+            GNUNET_asprintf (&newservicehome, "%s/%s/%d/", baseservicehome, 
hostname, off);
+          else
+            GNUNET_asprintf (&newservicehome, "%s/%d/", baseservicehome, off);
           GNUNET_free (baseservicehome);
         }
       else
         {
           tmpdir = getenv ("TMPDIR");
           tmpdir = tmpdir ? tmpdir : "/tmp";
-          GNUNET_asprintf (&newservicehome, "%s/%s/%d/", tmpdir,
-                           "gnunet-testing-test-test", off);
+          if (hostname != NULL)
+            GNUNET_asprintf (&newservicehome, "%s/%s/%s/%d/", tmpdir, hostname,
+                             "gnunet-testing-test-test", off);
+          else
+            GNUNET_asprintf (&newservicehome, "%s/%s/%d/", tmpdir,
+                             "gnunet-testing-test-test", off);
         }
       GNUNET_CONFIGURATION_set_value_string (pcfg, "PATHS", "SERVICEHOME",
                                              newservicehome);




reply via email to

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