diff options
-rw-r--r-- | src/mesh/gnunet-regex-profiler.c | 21 | ||||
-rw-r--r-- | src/testbed/gnunet-testbed-profiler.c | 9 | ||||
-rw-r--r-- | src/testbed/testbed_api.c | 8 | ||||
-rw-r--r-- | src/testbed/testbed_api_hosts.c | 15 | ||||
-rw-r--r-- | src/testbed/testbed_api_hosts.h | 10 | ||||
-rw-r--r-- | src/testbed/testbed_api_testbed.c | 7 |
6 files changed, 30 insertions, 40 deletions
diff --git a/src/mesh/gnunet-regex-profiler.c b/src/mesh/gnunet-regex-profiler.c index 5e31af47e7..14fadd89aa 100644 --- a/src/mesh/gnunet-regex-profiler.c +++ b/src/mesh/gnunet-regex-profiler.c @@ -1697,8 +1697,23 @@ host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *host, int status static unsigned int hosts_checked; *hc_handle = NULL; - if (++hosts_checked < num_hosts) + if (GNUNET_NO == status) + { + if ((NULL != host) && (NULL != GNUNET_TESTBED_host_get_hostname (host))) + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Host %s cannot start testbed\n"), + GNUNET_TESTBED_host_get_hostname (host)); + else + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Testbed cannot be started on localhost\n")); + GNUNET_SCHEDULER_cancel (abort_task); + abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL); + return; + } + hosts_checked++; + /* printf (_("\rChecked %u hosts"), hosts_checked); */ + /* fflush (stdout); */ + if (hosts_checked < num_hosts) return; + /* printf (_("\nAll hosts can start testbed. Creating peers\n")); */ GNUNET_free (hc_handles); hc_handles = NULL; mc_proc = @@ -1742,6 +1757,7 @@ run (void *cls, char *const *args, const char *cfgfile, fprintf (stderr, _("No hosts loaded. Need at least one host\n")); return; } + printf (_("Checking whether given hosts can start testbed. Please wait\n")); hc_handles = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_HostHabitableCheckHandle *) * num_hosts); @@ -1751,8 +1767,7 @@ run (void *cls, char *const *args, const char *cfgfile, &host_habitable_cb, &hc_handles[nhost]))) { - fprintf (stderr, _("Host %s cannot start testbed\n"), - GNUNET_TESTBED_host_get_hostname (hosts[nhost])); + GNUNET_break (0); for (nhost = 0; nhost < num_hosts; nhost++) if (NULL != hc_handles[nhost]) GNUNET_TESTBED_is_host_habitable_cancel (hc_handles[nhost]); diff --git a/src/testbed/gnunet-testbed-profiler.c b/src/testbed/gnunet-testbed-profiler.c index 0990905e99..4b8a958492 100644 --- a/src/testbed/gnunet-testbed-profiler.c +++ b/src/testbed/gnunet-testbed-profiler.c @@ -719,9 +719,9 @@ host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *host, int status *hc_handle = NULL; if (GNUNET_NO == status) { - if ((NULL != host) && (NULL != GNUNET_TESTBED_host_get_hostname_ (host))) + if ((NULL != host) && (NULL != GNUNET_TESTBED_host_get_hostname (host))) LOG (GNUNET_ERROR_TYPE_ERROR, _("Host %s cannot start testbed\n"), - GNUNET_TESTBED_host_get_hostname_ (host)); + GNUNET_TESTBED_host_get_hostname (host)); else LOG (GNUNET_ERROR_TYPE_ERROR, _("Testbed cannot be started on localhost\n")); GNUNET_SCHEDULER_cancel (abort_task); @@ -737,7 +737,7 @@ host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *host, int status GNUNET_free (hc_handles); hc_handles = NULL; mc_proc = - GNUNET_TESTBED_controller_start (GNUNET_TESTBED_host_get_hostname_ + GNUNET_TESTBED_controller_start (GNUNET_TESTBED_host_get_hostname (hosts[0]), hosts[0], cfg, @@ -786,8 +786,7 @@ run (void *cls, char *const *args, const char *cfgfile, &host_habitable_cb, &hc_handles[nhost]))) { - fprintf (stderr, _("Host %s cannot start testbed\n"), - GNUNET_TESTBED_host_get_hostname_ (hosts[nhost])); + GNUNET_break (0); for (nhost = 0; nhost < num_hosts; nhost++) if (NULL != hc_handles[nhost]) GNUNET_TESTBED_is_host_habitable_cancel (hc_handles[nhost]); diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c index e171f21a72..a1be406cf9 100644 --- a/src/testbed/testbed_api.c +++ b/src/testbed/testbed_api.c @@ -1169,7 +1169,7 @@ helper_mst (void *cls, void *client, const struct GNUNET_MessageHeader *message) (cp->cfg, config, config_size, GNUNET_NO)); GNUNET_free (config); if ((NULL == cp->host) || - (NULL == (hostname = GNUNET_TESTBED_host_get_hostname_ (cp->host)))) + (NULL == (hostname = GNUNET_TESTBED_host_get_hostname (cp->host)))) hostname = "localhost"; /* Change the hostname so that we can connect to it */ GNUNET_CONFIGURATION_set_value_string (cp->cfg, "testbed", "hostname", @@ -1409,7 +1409,7 @@ GNUNET_TESTBED_controller_start (const char *controller_ip, unsigned int argp; username = GNUNET_TESTBED_host_get_username_ (host); - hostname = GNUNET_TESTBED_host_get_hostname_ (host); + hostname = GNUNET_TESTBED_host_get_hostname (host); GNUNET_asprintf (&port, "%u", GNUNET_TESTBED_host_get_ssh_port_ (host)); if (NULL == username) GNUNET_asprintf (&dst, "%s", hostname); @@ -1590,7 +1590,7 @@ GNUNET_TESTBED_controller_connect (const struct GNUNET_CONFIGURATION_Handle GNUNET_TESTBED_operation_queue_create_ (controller->num_parallel_connects); controller->num_parallel_connects_threshold = num_parallel_connects_threshold; - controller_hostname = GNUNET_TESTBED_host_get_hostname_ (host); + controller_hostname = GNUNET_TESTBED_host_get_hostname (host); if (NULL == controller_hostname) controller_hostname = "127.0.0.1"; msg = @@ -1713,7 +1713,7 @@ GNUNET_TESTBED_register_host (struct GNUNET_TESTBED_Controller *controller, if (NULL != controller->rh) return NULL; - hostname = GNUNET_TESTBED_host_get_hostname_ (host); + hostname = GNUNET_TESTBED_host_get_hostname (host); if (GNUNET_YES == GNUNET_TESTBED_is_host_registered_ (host, controller)) { LOG (GNUNET_ERROR_TYPE_WARNING, "Host hostname: %s already registered\n", diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c index 6b797b895d..9cb4bc7968 100644 --- a/src/testbed/testbed_api_hosts.c +++ b/src/testbed/testbed_api_hosts.c @@ -183,22 +183,9 @@ GNUNET_TESTBED_host_get_id_ (const struct GNUNET_TESTBED_Host * host) * @return hostname of the host */ const char * -GNUNET_TESTBED_host_get_hostname_ (const struct GNUNET_TESTBED_Host *host) -{ - return host->hostname; -} - - -/** - * Obtain the host's hostname. - * - * @param host handle to the host, NULL means 'localhost' - * @return hostname of the host - */ -const char * GNUNET_TESTBED_host_get_hostname (const struct GNUNET_TESTBED_Host *host) { - return GNUNET_TESTBED_host_get_hostname_ (host); + return host->hostname; } diff --git a/src/testbed/testbed_api_hosts.h b/src/testbed/testbed_api_hosts.h index ea93579b0a..c0f42909af 100644 --- a/src/testbed/testbed_api_hosts.h +++ b/src/testbed/testbed_api_hosts.h @@ -67,16 +67,6 @@ GNUNET_TESTBED_host_get_id_ (const struct GNUNET_TESTBED_Host *host); /** - * Obtain the host's hostname. - * - * @param host handle to the host, NULL means 'localhost' - * @return hostname of the host - */ -const char * -GNUNET_TESTBED_host_get_hostname_ (const struct GNUNET_TESTBED_Host *host); - - -/** * Obtain the host's username * * @param host handle to the host, NULL means 'localhost' diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c index 0c3805ae67..c4a409b892 100644 --- a/src/testbed/testbed_api_testbed.c +++ b/src/testbed/testbed_api_testbed.c @@ -848,9 +848,9 @@ host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *host, int status rc->hc_handles[nhost] = NULL; if (GNUNET_NO == status) { - if ((NULL != host) && (NULL != GNUNET_TESTBED_host_get_hostname_ (host))) + if ((NULL != host) && (NULL != GNUNET_TESTBED_host_get_hostname (host))) LOG (GNUNET_ERROR_TYPE_ERROR, _("Host %s cannot start testbed\n"), - GNUNET_TESTBED_host_get_hostname_ (host)); + GNUNET_TESTBED_host_get_hostname (host)); else LOG (GNUNET_ERROR_TYPE_ERROR, _("Testbed cannot be started on localhost\n")); GNUNET_SCHEDULER_cancel (rc->shutdown_run_task); @@ -1013,8 +1013,7 @@ GNUNET_TESTBED_run (const char *host_filename, &host_habitable_cb, rc))) { - LOG (GNUNET_ERROR_TYPE_WARNING, "Host %s cannot start testbed\n", - GNUNET_TESTBED_host_get_hostname_ (rc->hosts[nhost])); + GNUNET_break (0); for (nhost = 0; nhost < rc->num_hosts; nhost++) if (NULL != rc->hc_handles[nhost]) GNUNET_TESTBED_is_host_habitable_cancel (rc->hc_handles[nhost]); |