Repository: mesos Updated Branches: refs/heads/master e76954abb -> 961c26528
Provide a default bind() in Socket: any port localhost. This makes it clearer when we intend to bind on a specific ip:port (socket.bind(node)) and when we just want to bind to any local port (socket.bind()). Review: https://reviews.apache.org/r/28485 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/961c2652 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/961c2652 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/961c2652 Branch: refs/heads/master Commit: 961c26528bea961970b49656b371f42c0d3408e7 Parents: e76954a Author: Joris Van Remoortere <[email protected]> Authored: Fri Mar 20 11:31:50 2015 -0700 Committer: Jie Yu <[email protected]> Committed: Fri Mar 20 11:31:51 2015 -0700 ---------------------------------------------------------------------- 3rdparty/libprocess/include/process/address.hpp | 5 +++++ 3rdparty/libprocess/include/process/socket.hpp | 2 +- 3rdparty/libprocess/src/process.cpp | 3 +-- 3 files changed, 7 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/961c2652/3rdparty/libprocess/include/process/address.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/include/process/address.hpp b/3rdparty/libprocess/include/process/address.hpp index 0f0a577..729f5cd 100644 --- a/3rdparty/libprocess/include/process/address.hpp +++ b/3rdparty/libprocess/include/process/address.hpp @@ -31,6 +31,11 @@ public: Address(const net::IP& _ip, uint16_t _port) : ip(_ip), port(_port) {} + static Address LOCALHOST_ANY() + { + return Address(net::IP(INADDR_ANY), 0); + } + static Try<Address> create(const struct sockaddr_storage& storage) { switch (storage.ss_family) { http://git-wip-us.apache.org/repos/asf/mesos/blob/961c2652/3rdparty/libprocess/include/process/socket.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/include/process/socket.hpp b/3rdparty/libprocess/include/process/socket.hpp index 2c42587..b8c2274 100644 --- a/3rdparty/libprocess/include/process/socket.hpp +++ b/3rdparty/libprocess/include/process/socket.hpp @@ -122,7 +122,7 @@ public: return impl->get(); } - Try<Address> bind(const Address& address) + Try<Address> bind(const Address& address = Address::LOCALHOST_ANY()) { return impl->bind(address); } http://git-wip-us.apache.org/repos/asf/mesos/blob/961c2652/3rdparty/libprocess/src/process.cpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp index 10ad670..cf4e364 100644 --- a/3rdparty/libprocess/src/process.cpp +++ b/3rdparty/libprocess/src/process.cpp @@ -776,8 +776,7 @@ void initialize(const string& delegate) LOG(FATAL) << "Failed to initialize, pthread_create"; } - __address__.ip = net::IP(INADDR_ANY); - __address__.port = 0; + __address__ = Address::LOCALHOST_ANY(); char* value;
