aboutsummaryrefslogtreecommitdiff
path: root/src/testing
diff options
context:
space:
mode:
authorNathan S. Evans <evans@in.tum.de>2011-03-02 11:39:01 +0000
committerNathan S. Evans <evans@in.tum.de>2011-03-02 11:39:01 +0000
commit2838de5efb2c74e0eff4d306c767d6beb668be41 (patch)
tree01a8f5d719c8aa6460eb38232138e65c0d8f6e34 /src/testing
parent46ef10befdb1ab8e1fd1d7f5304648a578e7f833 (diff)
downloadgnunet-2838de5efb2c74e0eff4d306c767d6beb668be41.tar.gz
gnunet-2838de5efb2c74e0eff4d306c767d6beb668be41.zip
Remove useless hostkey dilly-dallying in testing.
Diffstat (limited to 'src/testing')
-rw-r--r--src/testing/testing.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/testing/testing.c b/src/testing/testing.c
index 4a321c6e6..7f5ef2a01 100644
--- a/src/testing/testing.c
+++ b/src/testing/testing.c
@@ -435,6 +435,8 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
435#if DEBUG_TESTING 435#if DEBUG_TESTING
436 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully got hostkey!\n"); 436 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Successfully got hostkey!\n");
437#endif 437#endif
438 /* Fall through */
439 case SP_HOSTKEY_CREATED:
438 if (d->hostkey_callback != NULL) 440 if (d->hostkey_callback != NULL)
439 { 441 {
440 d->hostkey_callback (d->hostkey_cls, &d->id, d, NULL); 442 d->hostkey_callback (d->hostkey_cls, &d->id, d, NULL);
@@ -444,8 +446,6 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
444 { 446 {
445 d->phase = SP_TOPOLOGY_SETUP; 447 d->phase = SP_TOPOLOGY_SETUP;
446 } 448 }
447 /* Fall through */
448 case SP_HOSTKEY_CREATED:
449 /* wait for topology finished */ 449 /* wait for topology finished */
450 if ((GNUNET_YES == d->dead) 450 if ((GNUNET_YES == d->dead)
451 || (GNUNET_TIME_absolute_get_remaining (d->max_timeout).rel_value == 451 || (GNUNET_TIME_absolute_get_remaining (d->max_timeout).rel_value ==
@@ -903,6 +903,8 @@ GNUNET_TESTING_daemon_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
903 char *hostkeyfile; 903 char *hostkeyfile;
904 char *temp_file_name; 904 char *temp_file_name;
905 struct GNUNET_DISK_FileHandle *fn; 905 struct GNUNET_DISK_FileHandle *fn;
906 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded public_key;
907 struct GNUNET_CRYPTO_RsaPrivateKey *private_key;
906 908
907 ret = GNUNET_malloc (sizeof (struct GNUNET_TESTING_Daemon)); 909 ret = GNUNET_malloc (sizeof (struct GNUNET_TESTING_Daemon));
908 ret->hostname = (hostname == NULL) ? NULL : GNUNET_strdup (hostname); 910 ret->hostname = (hostname == NULL) ? NULL : GNUNET_strdup (hostname);
@@ -1065,7 +1067,18 @@ GNUNET_TESTING_daemon_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
1065 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1067 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1066 "No need to copy configuration file since we are running locally.\n"); 1068 "No need to copy configuration file since we are running locally.\n");
1067#endif 1069#endif
1068 ret->phase = SP_COPIED; 1070 if (hostkey != NULL) /* Get the peer identity from the hostkey */
1071 {
1072 private_key = GNUNET_CRYPTO_rsa_decode_key(hostkey, HOSTKEYFILESIZE);
1073 GNUNET_assert(private_key != NULL);
1074 GNUNET_CRYPTO_rsa_key_get_public (private_key,
1075 &public_key);
1076 GNUNET_CRYPTO_hash(&public_key, sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &ret->id.hashPubKey);
1077 ret->shortname = GNUNET_strdup(GNUNET_i2s(&ret->id));
1078 ret->phase = SP_HOSTKEY_CREATED;
1079 }
1080 else
1081 ret->phase = SP_COPIED;
1069 GNUNET_SCHEDULER_add_continuation (&start_fsm, 1082 GNUNET_SCHEDULER_add_continuation (&start_fsm,
1070 ret, 1083 ret,
1071 GNUNET_SCHEDULER_REASON_PREREQ_DONE); 1084 GNUNET_SCHEDULER_REASON_PREREQ_DONE);