From: Nathan S. Evans Date: Wed, 2 Mar 2011 13:19:55 +0000 (+0000) Subject: Fixes for testing because of my addled brain. X-Git-Tag: initial-import-from-subversion-38251~19034 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=57f3ffe332661aaa0327c54e9aa725cd011d8d04;p=oweals%2Fgnunet.git Fixes for testing because of my addled brain. --- diff --git a/src/testing/testing.c b/src/testing/testing.c index f876e05c1..8c50a2d91 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c @@ -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; } diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index f237ec030..155acb156 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c @@ -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);