From 9de4e858b1d8202df646e3af6252e4c4b15e1660 Mon Sep 17 00:00:00 2001 From: "Nathan S. Evans" Date: Wed, 31 Mar 2010 10:05:16 +0000 Subject: [PATCH] change hostname in config files when created, if running remotely... Otherwise the testing controller doesn't know whom to connect to. Since these daemons are ostensibly running on said remote hosts, changing the hostname shouldn't pose a problem (unless it does) --- src/testing/testing_group.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index 1769618cc..6815f99ff 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c @@ -164,6 +164,7 @@ struct UpdateContext { struct GNUNET_CONFIGURATION_Handle *ret; unsigned int nport; + const char *hostname; }; @@ -205,6 +206,12 @@ update_config (void *cls, GNUNET_snprintf (cval, sizeof (cval), "%u", ctx->nport++); value = cval; } + + if ((0 == strcmp (option, "HOSTNAME")) && (ctx->hostname != NULL)) + { + GNUNET_CONFIGURATION_set_value_string (ctx->ret, section, option, ctx->hostname); + } + GNUNET_CONFIGURATION_set_value_string (ctx->ret, section, option, value); } @@ -221,7 +228,7 @@ update_config (void *cls, * @return new configuration, NULL on error */ static struct GNUNET_CONFIGURATION_Handle * -make_config (const struct GNUNET_CONFIGURATION_Handle *cfg, uint16_t * port) +make_config (const struct GNUNET_CONFIGURATION_Handle *cfg, uint16_t * port, const char *hostname) { struct UpdateContext uc; uint16_t orig; @@ -231,6 +238,7 @@ make_config (const struct GNUNET_CONFIGURATION_Handle *cfg, uint16_t * port) orig = *port; uc.nport = *port; uc.ret = GNUNET_CONFIGURATION_create (); + uc.hostname = hostname; GNUNET_CONFIGURATION_iterate (cfg, &update_config, &uc); if (uc.nport >= HIGH_PORT) @@ -1251,12 +1259,12 @@ GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched, if (hostcnt > 0) { hostname = pg->hosts[off % hostcnt].hostname; - pcfg = make_config (cfg, &pg->hosts[off % hostcnt].minport); + pcfg = make_config (cfg, &pg->hosts[off % hostcnt].minport, hostname); } else { hostname = NULL; - pcfg = make_config (cfg, &minport); + pcfg = make_config (cfg, &minport, hostname); } if (NULL == pcfg) { -- 2.25.1