Introduced getIP and created initialization wrappers for sockaddr_in and addrinfo
Replaced obsolete functions gethostbyname2_r and gethostbyname2 with getaddrinfo and introduced getIP. Created initialization wrappers for sockaddr_in and addrinfo. Review: https://reviews.apache.org/r/28718 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/50c3a852 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/50c3a852 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/50c3a852 Branch: refs/heads/master Commit: 50c3a85253d75e85597bbde13e393f2e4c6fa16b Parents: 99bbe8c Author: Evelina Dumitrescu <[email protected]> Authored: Fri Dec 5 13:22:28 2014 -0800 Committer: Dominic Hamon <[email protected]> Committed: Fri Dec 5 13:27:53 2014 -0800 ---------------------------------------------------------------------- src/sched/sched.cpp | 2 +- src/tests/allocator_tests.cpp | 2 +- src/tests/master_tests.cpp | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/50c3a852/src/sched/sched.cpp ---------------------------------------------------------------------- diff --git a/src/sched/sched.cpp b/src/sched/sched.cpp index 0b08512..4be08f1 100644 --- a/src/sched/sched.cpp +++ b/src/sched/sched.cpp @@ -1174,7 +1174,7 @@ void MesosSchedulerDriver::initialize() { framework.set_user(user.get()); } if (framework.hostname().empty()) { - framework.set_hostname(os::hostname().get()); + framework.set_hostname(net::hostname().get()); } // Launch a local cluster if necessary. http://git-wip-us.apache.org/repos/asf/mesos/blob/50c3a852/src/tests/allocator_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/allocator_tests.cpp b/src/tests/allocator_tests.cpp index 65f05fd..8626362 100644 --- a/src/tests/allocator_tests.cpp +++ b/src/tests/allocator_tests.cpp @@ -2029,7 +2029,7 @@ TYPED_TEST(AllocatorTest, WhitelistSlave) slave::Flags flags = this->CreateSlaveFlags(); flags.resources = Some("cpus:2;mem:1024"); - Try<string> hostname = os::hostname(); + Try<string> hostname = net::hostname(); ASSERT_SOME(hostname); flags.hostname = hostname.get(); http://git-wip-us.apache.org/repos/asf/mesos/blob/50c3a852/src/tests/master_tests.cpp ---------------------------------------------------------------------- diff --git a/src/tests/master_tests.cpp b/src/tests/master_tests.cpp index 4be4815..7f796be 100644 --- a/src/tests/master_tests.cpp +++ b/src/tests/master_tests.cpp @@ -37,6 +37,7 @@ #include <process/metrics/metrics.hpp> #include <stout/json.hpp> +#include <stout/net.hpp> #include <stout/option.hpp> #include <stout/os.hpp> #include <stout/try.hpp> @@ -1053,7 +1054,7 @@ protected: TEST_F(WhitelistTest, WhitelistSlave) { // Add some hosts to the white list. - Try<string> hostname = os::hostname(); + Try<string> hostname = net::hostname(); ASSERT_SOME(hostname); string hosts = hostname.get() + "\n" + "dummy-slave";
