diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-12-04 10:34:39 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-12-04 10:34:39 +0000 |
commit | a317854b14a85a34f43655b1f74433c07f7ebbf9 (patch) | |
tree | 8e95b677c208bbf544ff415ba675ba5c8f2d5e2f /src/testbed/testbed_api_testbed.c | |
parent | f6b3966b20fa4dbf737752f2959b78cdba03341d (diff) |
- use localhost without chcking when hosts file is NULL
Diffstat (limited to 'src/testbed/testbed_api_testbed.c')
-rw-r--r-- | src/testbed/testbed_api_testbed.c | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/src/testbed/testbed_api_testbed.c b/src/testbed/testbed_api_testbed.c index a87f1f0581..3617f9a3de 100644 --- a/src/testbed/testbed_api_testbed.c +++ b/src/testbed/testbed_api_testbed.c @@ -941,11 +941,7 @@ GNUNET_TESTBED_run (const char *host_filename, } } else - { - rc->hosts = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Host *)); - rc->hosts[0] = GNUNET_TESTBED_host_create (NULL, NULL, 0); - rc->num_hosts = 1; - } + rc->h = GNUNET_TESTBED_host_create (NULL, NULL, 0); rc->cfg = GNUNET_CONFIGURATION_dup (cfg); rc->num_peers = num_peers; rc->event_mask = event_mask; @@ -1003,31 +999,38 @@ GNUNET_TESTBED_run (const char *host_filename, /* Do nothing */ break; } - rc->hc_handles = GNUNET_malloc (sizeof (struct - GNUNET_TESTBED_HostHabitableCheckHandle *) - * rc->num_hosts); - for (nhost = 0; nhost < rc->num_hosts; nhost++) - { - if (NULL == (rc->hc_handles[nhost] = - GNUNET_TESTBED_is_host_habitable (rc->hosts[nhost], rc->cfg, - &host_habitable_cb, - rc))) - { - 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]); - GNUNET_free (rc->hc_handles); - rc->hc_handles = NULL; - goto error_cleanup; + if (NULL != host_filename) + { + rc->hc_handles = GNUNET_malloc (sizeof (struct + GNUNET_TESTBED_HostHabitableCheckHandle *) + * rc->num_hosts); + for (nhost = 0; nhost < rc->num_hosts; nhost++) + { + if (NULL == (rc->hc_handles[nhost] = + GNUNET_TESTBED_is_host_habitable (rc->hosts[nhost], rc->cfg, + &host_habitable_cb, + rc))) + { + 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]); + GNUNET_free (rc->hc_handles); + rc->hc_handles = NULL; + goto error_cleanup; + } } } + else + rc->cproc = + GNUNET_TESTBED_controller_start ("127.0.0.1", rc->h, rc->cfg, + &controller_status_cb, rc); rc->shutdown_run_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_run, rc); return; - error_cleanup: + error_cleanup: if (NULL != rc->h) GNUNET_TESTBED_host_destroy (rc->h); if (NULL != rc->hosts) |