diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2013-05-14 15:34:12 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2013-05-14 15:34:12 +0000 |
commit | 90cf3dbae0ad35e49ae0de58921b90b71d031f6f (patch) | |
tree | 636a474956dbf6108b9df7b3c33eaeb4915bc97c /src | |
parent | 372ef9e526321fe9c9e2cbc0e3ee6151f6f6b367 (diff) | |
download | gnunet-90cf3dbae0ad35e49ae0de58921b90b71d031f6f.tar.gz gnunet-90cf3dbae0ad35e49ae0de58921b90b71d031f6f.zip |
- sort hosts returned from loadleveler
Diffstat (limited to 'src')
-rw-r--r-- | src/testbed/testbed_api_hosts.c | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c index c2686ea62..f68fd19f3 100644 --- a/src/testbed/testbed_api_hosts.c +++ b/src/testbed/testbed_api_hosts.c | |||
@@ -589,9 +589,7 @@ GNUNET_TESTBED_hosts_load_from_loadleveler (const struct | |||
589 | char *buf; | 589 | char *buf; |
590 | char *hostname; | 590 | char *hostname; |
591 | char **hostnames; | 591 | char **hostnames; |
592 | char **hostaddrs; | 592 | struct GNUNET_TESTBED_Host **host_list; |
593 | const char *hostip; | ||
594 | struct GNUNET_TESTBED_Host **host_list; | ||
595 | ssize_t rsize; | 593 | ssize_t rsize; |
596 | uint64_t size; | 594 | uint64_t size; |
597 | uint64_t offset; | 595 | uint64_t offset; |
@@ -603,7 +601,6 @@ GNUNET_TESTBED_hosts_load_from_loadleveler (const struct | |||
603 | } pstep; | 601 | } pstep; |
604 | unsigned int host; | 602 | unsigned int host; |
605 | unsigned int nhosts; | 603 | unsigned int nhosts; |
606 | unsigned int nhostaddrs; | ||
607 | 604 | ||
608 | if (NULL == (hostfile = getenv ("MP_SAVEHOSTFILE"))) | 605 | if (NULL == (hostfile = getenv ("MP_SAVEHOSTFILE"))) |
609 | { | 606 | { |
@@ -634,9 +631,7 @@ GNUNET_TESTBED_hosts_load_from_loadleveler (const struct | |||
634 | pstep = SCAN; | 631 | pstep = SCAN; |
635 | hostname = NULL; | 632 | hostname = NULL; |
636 | hostnames = NULL; | 633 | hostnames = NULL; |
637 | hostaddrs = NULL; | ||
638 | nhosts = 0; | 634 | nhosts = 0; |
639 | nhostaddrs = 0; | ||
640 | while (offset < size) | 635 | while (offset < size) |
641 | { | 636 | { |
642 | switch (pstep) | 637 | switch (pstep) |
@@ -692,31 +687,17 @@ GNUNET_TESTBED_hosts_load_from_loadleveler (const struct | |||
692 | GNUNET_free_non_null (buf); | 687 | GNUNET_free_non_null (buf); |
693 | if (NULL == hostnames) | 688 | if (NULL == hostnames) |
694 | return 0; | 689 | return 0; |
695 | for (host = 0; host < nhosts; host++) | ||
696 | { | ||
697 | hostip = simple_resolve (hostnames[host]); | ||
698 | if (NULL == hostip) | ||
699 | { | ||
700 | nhosts = 0; | ||
701 | goto cleanup; | ||
702 | } | ||
703 | GNUNET_array_append (hostaddrs, nhostaddrs, GNUNET_strdup (hostip)); | ||
704 | } | ||
705 | GNUNET_assert (nhostaddrs == nhosts); | ||
706 | if (NULL == hosts) | 690 | if (NULL == hosts) |
707 | goto cleanup; | 691 | goto cleanup; |
708 | host_list = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Host *) * nhostaddrs); | 692 | host_list = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Host *) * nhosts); |
709 | for (host = 0; host < nhosts; host++) | 693 | for (host = 0; host < nhosts; host++) |
710 | host_list[host] = GNUNET_TESTBED_host_create (hostaddrs[host], NULL, cfg, 0); | 694 | host_list[host] = GNUNET_TESTBED_host_create (hostnames[host], NULL, cfg, 0); |
711 | *hosts = host_list; | 695 | *hosts = host_list; |
712 | 696 | ||
713 | cleanup: | 697 | cleanup: |
714 | for (host = 0; host < nhosts; host++) | 698 | for (host = 0; host < nhosts; host++) |
715 | GNUNET_free (hostnames[host]); | 699 | GNUNET_free (hostnames[host]); |
716 | GNUNET_free(hostnames); | 700 | GNUNET_free(hostnames); |
717 | for (host = 0; (NULL != hostaddrs) && (host < nhostaddrs); host++) | ||
718 | GNUNET_free (hostaddrs[host]); | ||
719 | GNUNET_free (hostaddrs); | ||
720 | return nhosts; | 701 | return nhosts; |
721 | #endif | 702 | #endif |
722 | } | 703 | } |