You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2016/11/29 21:29:40 UTC
[07/14] mesos git commit: Updated usage of network::Address and
network::Socket in Mesos.
Updated usage of network::Address and network::Socket in Mesos.
Review: https://reviews.apache.org/r/53462
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/b64c9d42
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/b64c9d42
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/b64c9d42
Branch: refs/heads/master
Commit: b64c9d42c114ee81e0e83d96206a8ae1a664464c
Parents: 2529d07
Author: Benjamin Hindman <be...@gmail.com>
Authored: Thu Nov 3 23:39:07 2016 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Tue Nov 29 12:06:29 2016 -0800
----------------------------------------------------------------------
src/tests/fetcher_tests.cpp | 4 ++--
src/tests/utils.cpp | 21 ++++++++++-----------
2 files changed, 12 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/b64c9d42/src/tests/fetcher_tests.cpp
----------------------------------------------------------------------
diff --git a/src/tests/fetcher_tests.cpp b/src/tests/fetcher_tests.cpp
index 79526ae..8b8baf8 100644
--- a/src/tests/fetcher_tests.cpp
+++ b/src/tests/fetcher_tests.cpp
@@ -413,7 +413,7 @@ TEST_F(FetcherTest, OSNetUriTest)
{
Http http;
- const network::Address& address = http.process->self().address;
+ const network::inet::Address& address = http.process->self().address;
process::http::URL url(
"http",
@@ -458,7 +458,7 @@ TEST_F(FetcherTest, OSNetUriSpaceTest)
{
Http http;
- const network::Address& address = http.process->self().address;
+ const network::inet::Address& address = http.process->self().address;
process::http::URL url(
"http",
http://git-wip-us.apache.org/repos/asf/mesos/blob/b64c9d42/src/tests/utils.cpp
----------------------------------------------------------------------
diff --git a/src/tests/utils.cpp b/src/tests/utils.cpp
index d36aa9c..0a9e5a8 100644
--- a/src/tests/utils.cpp
+++ b/src/tests/utils.cpp
@@ -32,14 +32,13 @@
#include "tests/flags.hpp"
+namespace http = process::http;
+namespace inet = process::network::inet;
+
using std::string;
using process::Future;
using process::UPID;
-using process::address;
-
-namespace http = process::http;
-namespace network = process::network;
namespace mesos {
namespace internal {
@@ -53,7 +52,7 @@ const bool searchInstallationDirectory = false;
JSON::Object Metrics()
{
- UPID upid("metrics", address());
+ UPID upid("metrics", process::address());
// TODO(neilc): This request might timeout if the current value of a
// metric cannot be determined. In tests, a common cause for this is
@@ -73,20 +72,20 @@ JSON::Object Metrics()
Try<uint16_t> getFreePort()
{
// Bind to port=0 to obtain a random unused port.
- Try<network::Socket> socket = network::Socket::create();
+ Try<inet::Socket> socket = inet::Socket::create();
if (socket.isError()) {
return Error(socket.error());
}
- Try<network::Address> result = socket->bind(network::Address());
+ Try<inet::Address> address = socket->bind(inet::Address::ANY_ANY());
- if (result.isSome()) {
- return result->port;
- } else {
- return Error(result.error());
+ if (address.isError()) {
+ return Error(address.error());
}
+ return address->port;
+
// No explicit cleanup of `socket` as we rely on the implementation
// of `Socket` to close the socket on destruction.
}