Fixes for testing because of my addled brain.
authorNathan S. Evans <evans@in.tum.de>
Wed, 2 Mar 2011 13:19:55 +0000 (13:19 +0000)
committerNathan S. Evans <evans@in.tum.de>
Wed, 2 Mar 2011 13:19:55 +0000 (13:19 +0000)
src/testing/testing.c
src/testing/testing_group.c

index f876e05c1c3ccd974ef7671b318d2e692151dd7f..8c50a2d91ed1f772ac03ae95f5306db359c6c610 100644 (file)
@@ -164,7 +164,8 @@ testing_init (void *cls,
               "Successfully started peer `%4s'.\n", GNUNET_i2s (my_identity));
 #endif
   d->id = *my_identity;
-  d->shortname = strdup (GNUNET_i2s (my_identity));
+  if (d->shortname == NULL)
+    d->shortname = strdup (GNUNET_i2s (my_identity));
   d->server = server;
   d->running = GNUNET_YES;
 
@@ -267,6 +268,7 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
                 NULL, d->cfg, d, _("`scp' did not complete cleanly.\n"));
           return;
         }
+      GNUNET_OS_process_close(d->proc);
 #if DEBUG_TESTING
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Successfully copied configuration file.\n");
@@ -755,6 +757,10 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
           GNUNET_TRANSPORT_disconnect (d->th);
           d->th = NULL;
         }
+
+      if (NULL != d->dead_cb)
+        d->dead_cb (d->dead_cb_cls, NULL);
+
       /* state clean up and notifications */
       if (d->churn == GNUNET_NO)
         {
@@ -770,9 +776,6 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
       GNUNET_free_non_null (d->proc);
       d->proc = NULL;
       d->shortname = NULL;
-      if (NULL != d->dead_cb)
-        d->dead_cb (d->dead_cb_cls, NULL);
-
       if (d->churn == GNUNET_NO)
         GNUNET_free (d);
 
@@ -977,7 +980,7 @@ GNUNET_TESTING_daemon_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
       GNUNET_CRYPTO_hash(&public_key, sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &ret->id.hashPubKey);
       ret->shortname = GNUNET_strdup(GNUNET_i2s(&ret->id));
       ret->have_hostkey = GNUNET_YES;
-      GNUNET_free(private_key);
+      GNUNET_CRYPTO_rsa_key_free(private_key);
     }
 
   /* Write hostkey to file, if we were given one */
@@ -1093,6 +1096,7 @@ GNUNET_TESTING_daemon_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
         = GNUNET_SCHEDULER_add_delayed (GNUNET_CONSTANTS_EXEC_WAIT,
                                         &start_fsm, ret);
       GNUNET_free_non_null(hostkeyfile);
+      GNUNET_free(baseservicehome);
       GNUNET_free(servicehome);
       return ret;
     }
index f237ec030d3babfd6a32294fc1b61a4a1447c2fa..155acb156b081bcc8a26191d5697c473ccfaa422 100644 (file)
@@ -5845,7 +5845,9 @@ GNUNET_TESTING_daemons_start(
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                   "Creating remote dir with command ssh %s %s %s\n", arg,
                   " mkdir -p ", baseservicehome);
+      GNUNET_free(arg);
       GNUNET_OS_process_wait (proc);
+      GNUNET_OS_process_close(proc);
     }
   GNUNET_free(baseservicehome);
 
@@ -6449,8 +6451,9 @@ void
 internal_shutdown_callback(void *cls, const char *emsg)
 {
   struct PeerShutdownContext *peer_shutdown_ctx = cls;
-  struct ShutdownContext *shutdown_ctx = cls;
+  struct ShutdownContext *shutdown_ctx = peer_shutdown_ctx->shutdown_ctx;
   unsigned int off;
+  struct OutstandingSSH *ssh_pos;
 
   shutdown_ctx->outstanding--;
   if (peer_shutdown_ctx->daemon->hostname != NULL)
@@ -6483,8 +6486,12 @@ internal_shutdown_callback(void *cls, const char *emsg)
           GNUNET_free_non_null (shutdown_ctx->pg->hosts[off].username);
         }
       GNUNET_free_non_null (shutdown_ctx->pg->hosts);
+      while (NULL != (ssh_pos = shutdown_ctx->pg->ssh_head))
+        {
+          GNUNET_CONTAINER_DLL_remove(shutdown_ctx->pg->ssh_head, shutdown_ctx->pg->ssh_tail, ssh_pos);
+          GNUNET_free(ssh_pos);
+        }
       GNUNET_free (shutdown_ctx->pg);
-
       GNUNET_free (shutdown_ctx);
     }
   GNUNET_free(peer_shutdown_ctx);