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 5e31af47e..14fadd89a 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 | |||
1697 | static unsigned int hosts_checked; | 1697 | static unsigned int hosts_checked; |
1698 | 1698 | ||
1699 | *hc_handle = NULL; | 1699 | *hc_handle = NULL; |
1700 | if (++hosts_checked < num_hosts) | 1700 | if (GNUNET_NO == status) |
1701 | { | ||
1702 | if ((NULL != host) && (NULL != GNUNET_TESTBED_host_get_hostname (host))) | ||
1703 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Host %s cannot start testbed\n"), | ||
1704 | GNUNET_TESTBED_host_get_hostname (host)); | ||
1705 | else | ||
1706 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Testbed cannot be started on localhost\n")); | ||
1707 | GNUNET_SCHEDULER_cancel (abort_task); | ||
1708 | abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL); | ||
1709 | return; | ||
1710 | } | ||
1711 | hosts_checked++; | ||
1712 | /* printf (_("\rChecked %u hosts"), hosts_checked); */ | ||
1713 | /* fflush (stdout); */ | ||
1714 | if (hosts_checked < num_hosts) | ||
1701 | return; | 1715 | return; |
1716 | /* printf (_("\nAll hosts can start testbed. Creating peers\n")); */ | ||
1702 | GNUNET_free (hc_handles); | 1717 | GNUNET_free (hc_handles); |
1703 | hc_handles = NULL; | 1718 | hc_handles = NULL; |
1704 | mc_proc = | 1719 | mc_proc = |
@@ -1742,6 +1757,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
1742 | fprintf (stderr, _("No hosts loaded. Need at least one host\n")); | 1757 | fprintf (stderr, _("No hosts loaded. Need at least one host\n")); |
1743 | return; | 1758 | return; |
1744 | } | 1759 | } |
1760 | printf (_("Checking whether given hosts can start testbed. Please wait\n")); | ||
1745 | hc_handles = GNUNET_malloc (sizeof (struct | 1761 | hc_handles = GNUNET_malloc (sizeof (struct |
1746 | GNUNET_TESTBED_HostHabitableCheckHandle *) | 1762 | GNUNET_TESTBED_HostHabitableCheckHandle *) |
1747 | * num_hosts); | 1763 | * num_hosts); |
@@ -1751,8 +1767,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
1751 | &host_habitable_cb, | 1767 | &host_habitable_cb, |
1752 | &hc_handles[nhost]))) | 1768 | &hc_handles[nhost]))) |
1753 | { | 1769 | { |
1754 | fprintf (stderr, _("Host %s cannot start testbed\n"), | 1770 | GNUNET_break (0); |
1755 | GNUNET_TESTBED_host_get_hostname (hosts[nhost])); | ||
1756 | for (nhost = 0; nhost < num_hosts; nhost++) | 1771 | for (nhost = 0; nhost < num_hosts; nhost++) |
1757 | if (NULL != hc_handles[nhost]) | 1772 | if (NULL != hc_handles[nhost]) |
1758 | GNUNET_TESTBED_is_host_habitable_cancel (hc_handles[nhost]); | 1773 | 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 0990905e9..4b8a95849 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 | |||
719 | *hc_handle = NULL; | 719 | *hc_handle = NULL; |
720 | if (GNUNET_NO == status) | 720 | if (GNUNET_NO == status) |
721 | { | 721 | { |
722 | if ((NULL != host) && (NULL != GNUNET_TESTBED_host_get_hostname_ (host))) | 722 | if ((NULL != host) && (NULL != GNUNET_TESTBED_host_get_hostname (host))) |
723 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Host %s cannot start testbed\n"), | 723 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Host %s cannot start testbed\n"), |
724 | GNUNET_TESTBED_host_get_hostname_ (host)); | 724 | GNUNET_TESTBED_host_get_hostname (host)); |
725 | else | 725 | else |
726 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Testbed cannot be started on localhost\n")); | 726 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Testbed cannot be started on localhost\n")); |
727 | GNUNET_SCHEDULER_cancel (abort_task); | 727 | GNUNET_SCHEDULER_cancel (abort_task); |
@@ -737,7 +737,7 @@ host_habitable_cb (void *cls, const struct GNUNET_TESTBED_Host *host, int status | |||
737 | GNUNET_free (hc_handles); | 737 | GNUNET_free (hc_handles); |
738 | hc_handles = NULL; | 738 | hc_handles = NULL; |
739 | mc_proc = | 739 | mc_proc = |
740 | GNUNET_TESTBED_controller_start (GNUNET_TESTBED_host_get_hostname_ | 740 | GNUNET_TESTBED_controller_start (GNUNET_TESTBED_host_get_hostname |
741 | (hosts[0]), | 741 | (hosts[0]), |
742 | hosts[0], | 742 | hosts[0], |
743 | cfg, | 743 | cfg, |
@@ -786,8 +786,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
786 | &host_habitable_cb, | 786 | &host_habitable_cb, |
787 | &hc_handles[nhost]))) | 787 | &hc_handles[nhost]))) |
788 | { | 788 | { |
789 | fprintf (stderr, _("Host %s cannot start testbed\n"), | 789 | GNUNET_break (0); |
790 | GNUNET_TESTBED_host_get_hostname_ (hosts[nhost])); | ||
791 | for (nhost = 0; nhost < num_hosts; nhost++) | 790 | for (nhost = 0; nhost < num_hosts; nhost++) |
792 | if (NULL != hc_handles[nhost]) | 791 | if (NULL != hc_handles[nhost]) |
793 | GNUNET_TESTBED_is_host_habitable_cancel (hc_handles[nhost]); | 792 | GNUNET_TESTBED_is_host_habitable_cancel (hc_handles[nhost]); |
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c index e171f21a7..a1be406cf 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) | |||
1169 | (cp->cfg, config, config_size, GNUNET_NO)); | 1169 | (cp->cfg, config, config_size, GNUNET_NO)); |
1170 | GNUNET_free (config); | 1170 | GNUNET_free (config); |
1171 | if ((NULL == cp->host) || | 1171 | if ((NULL == cp->host) || |
1172 | (NULL == (hostname = GNUNET_TESTBED_host_get_hostname_ (cp->host)))) | 1172 | (NULL == (hostname = GNUNET_TESTBED_host_get_hostname (cp->host)))) |
1173 | hostname = "localhost"; | 1173 | hostname = "localhost"; |
1174 | /* Change the hostname so that we can connect to it */ | 1174 | /* Change the hostname so that we can connect to it */ |
1175 | GNUNET_CONFIGURATION_set_value_string (cp->cfg, "testbed", "hostname", | 1175 | GNUNET_CONFIGURATION_set_value_string (cp->cfg, "testbed", "hostname", |
@@ -1409,7 +1409,7 @@ GNUNET_TESTBED_controller_start (const char *controller_ip, | |||
1409 | unsigned int argp; | 1409 | unsigned int argp; |
1410 | 1410 | ||
1411 | username = GNUNET_TESTBED_host_get_username_ (host); | 1411 | username = GNUNET_TESTBED_host_get_username_ (host); |
1412 | hostname = GNUNET_TESTBED_host_get_hostname_ (host); | 1412 | hostname = GNUNET_TESTBED_host_get_hostname (host); |
1413 | GNUNET_asprintf (&port, "%u", GNUNET_TESTBED_host_get_ssh_port_ (host)); | 1413 | GNUNET_asprintf (&port, "%u", GNUNET_TESTBED_host_get_ssh_port_ (host)); |
1414 | if (NULL == username) | 1414 | if (NULL == username) |
1415 | GNUNET_asprintf (&dst, "%s", hostname); | 1415 | GNUNET_asprintf (&dst, "%s", hostname); |
@@ -1590,7 +1590,7 @@ GNUNET_TESTBED_controller_connect (const struct GNUNET_CONFIGURATION_Handle | |||
1590 | GNUNET_TESTBED_operation_queue_create_ | 1590 | GNUNET_TESTBED_operation_queue_create_ |
1591 | (controller->num_parallel_connects); | 1591 | (controller->num_parallel_connects); |
1592 | controller->num_parallel_connects_threshold = num_parallel_connects_threshold; | 1592 | controller->num_parallel_connects_threshold = num_parallel_connects_threshold; |
1593 | controller_hostname = GNUNET_TESTBED_host_get_hostname_ (host); | 1593 | controller_hostname = GNUNET_TESTBED_host_get_hostname (host); |
1594 | if (NULL == controller_hostname) | 1594 | if (NULL == controller_hostname) |
1595 | controller_hostname = "127.0.0.1"; | 1595 | controller_hostname = "127.0.0.1"; |
1596 | msg = | 1596 | msg = |
@@ -1713,7 +1713,7 @@ GNUNET_TESTBED_register_host (struct GNUNET_TESTBED_Controller *controller, | |||
1713 | 1713 | ||
1714 | if (NULL != controller->rh) | 1714 | if (NULL != controller->rh) |
1715 | return NULL; | 1715 | return NULL; |
1716 | hostname = GNUNET_TESTBED_host_get_hostname_ (host); | 1716 | hostname = GNUNET_TESTBED_host_get_hostname (host); |
1717 | if (GNUNET_YES == GNUNET_TESTBED_is_host_registered_ (host, controller)) | 1717 | if (GNUNET_YES == GNUNET_TESTBED_is_host_registered_ (host, controller)) |
1718 | { | 1718 | { |
1719 | LOG (GNUNET_ERROR_TYPE_WARNING, "Host hostname: %s already registered\n", | 1719 | 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 6b797b895..9cb4bc796 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) | |||
183 | * @return hostname of the host | 183 | * @return hostname of the host |
184 | */ | 184 | */ |
185 | const char * | 185 | const char * |
186 | GNUNET_TESTBED_host_get_hostname_ (const struct GNUNET_TESTBED_Host *host) | ||
187 | { | ||
188 | return host->hostname; | ||
189 | } | ||
190 | |||
191 | |||
192 | /** | ||
193 | * Obtain the host's hostname. | ||
194 | * | ||
195 | * @param host handle to the host, NULL means 'localhost' | ||
196 | * @return hostname of the host | ||
197 | */ | ||
198 | const char * | ||
199 | GNUNET_TESTBED_host_get_hostname (const struct GNUNET_TESTBED_Host *host) | 186 | GNUNET_TESTBED_host_get_hostname (const struct GNUNET_TESTBED_Host *host) |
200 | { | 187 | { |
201 | return GNUNET_TESTBED_host_get_hostname_ (host); | 188 | return host->hostname; |
202 | } | 189 | } |
203 | 190 | ||
204 | 191 | ||
diff --git a/src/testbed/testbed_api_hosts.h b/src/testbed/testbed_api_hosts.h index ea93579b0..c0f42909a 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); | |||
67 | 67 | ||
68 | 68 | ||
69 | /** | 69 | /** |
70 | * Obtain the host's hostname. | ||
71 | * | ||
72 | * @param host handle to the host, NULL means 'localhost' | ||
73 | * @return hostname of the host | ||
74 | */ | ||
75 | const char * | ||
76 | GNUNET_TESTBED_host_get_hostname_ (const struct GNUNET_TESTBED_Host *host); | ||
77 | |||
78 | |||
79 | /** | ||
80 | * Obtain the host's username | 70 | * Obtain the host's username |
81 | * | 71 | * |
82 | * @param host handle to the host, NULL means 'localhost' | 72 | * @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 0c3805ae6..c4a409b89 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 | |||
848 | rc->hc_handles[nhost] = NULL; | 848 | rc->hc_handles[nhost] = NULL; |
849 | if (GNUNET_NO == status) | 849 | if (GNUNET_NO == status) |
850 | { | 850 | { |
851 | if ((NULL != host) && (NULL != GNUNET_TESTBED_host_get_hostname_ (host))) | 851 | if ((NULL != host) && (NULL != GNUNET_TESTBED_host_get_hostname (host))) |
852 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Host %s cannot start testbed\n"), | 852 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Host %s cannot start testbed\n"), |
853 | GNUNET_TESTBED_host_get_hostname_ (host)); | 853 | GNUNET_TESTBED_host_get_hostname (host)); |
854 | else | 854 | else |
855 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Testbed cannot be started on localhost\n")); | 855 | LOG (GNUNET_ERROR_TYPE_ERROR, _("Testbed cannot be started on localhost\n")); |
856 | GNUNET_SCHEDULER_cancel (rc->shutdown_run_task); | 856 | GNUNET_SCHEDULER_cancel (rc->shutdown_run_task); |
@@ -1013,8 +1013,7 @@ GNUNET_TESTBED_run (const char *host_filename, | |||
1013 | &host_habitable_cb, | 1013 | &host_habitable_cb, |
1014 | rc))) | 1014 | rc))) |
1015 | { | 1015 | { |
1016 | LOG (GNUNET_ERROR_TYPE_WARNING, "Host %s cannot start testbed\n", | 1016 | GNUNET_break (0); |
1017 | GNUNET_TESTBED_host_get_hostname_ (rc->hosts[nhost])); | ||
1018 | for (nhost = 0; nhost < rc->num_hosts; nhost++) | 1017 | for (nhost = 0; nhost < rc->num_hosts; nhost++) |
1019 | if (NULL != rc->hc_handles[nhost]) | 1018 | if (NULL != rc->hc_handles[nhost]) |
1020 | GNUNET_TESTBED_is_host_habitable_cancel (rc->hc_handles[nhost]); | 1019 | GNUNET_TESTBED_is_host_habitable_cancel (rc->hc_handles[nhost]); |