From 84ccd279f2910a73b10678685b2a6a90bb6dd8fb Mon Sep 17 00:00:00 2001 From: Adam Cooper Date: Mon, 11 Jun 2018 17:35:51 -0400 Subject: SERVER-35101 Strip trailing and leading whitespace from bind_ip arguments and change to std::vector internally --- src/mongo/db/repl/isself.cpp | 6 +----- src/mongo/db/repl/repl_set_commands.cpp | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) (limited to 'src/mongo/db/repl') diff --git a/src/mongo/db/repl/isself.cpp b/src/mongo/db/repl/isself.cpp index 2d32cfc0b8e..8b7f8daa751 100644 --- a/src/mongo/db/repl/isself.cpp +++ b/src/mongo/db/repl/isself.cpp @@ -161,11 +161,7 @@ bool isSelf(const HostAndPort& hostAndPort, ServiceContext* const ctx) { // of the interfaces on this machine. // No need for ip match if the ports do not match if (hostAndPort.port() == serverGlobalParams.port) { - std::vector myAddrs; - - if (!serverGlobalParams.bind_ip.empty()) { - boost::split(myAddrs, serverGlobalParams.bind_ip, boost::is_any_of(", ")); - } + std::vector myAddrs = serverGlobalParams.bind_ips; // If any of the bound addresses is the default route (0.0.0.0 on IPv4) it means we are // listening on all network interfaces and need to check against any of them. diff --git a/src/mongo/db/repl/repl_set_commands.cpp b/src/mongo/db/repl/repl_set_commands.cpp index 6b2877cacb7..103612358d2 100644 --- a/src/mongo/db/repl/repl_set_commands.cpp +++ b/src/mongo/db/repl/repl_set_commands.cpp @@ -199,15 +199,11 @@ private: namespace { HostAndPort someHostAndPortForMe() { - const auto& bind_ip = serverGlobalParams.bind_ip; + const auto& addrs = serverGlobalParams.bind_ips; const auto& bind_port = serverGlobalParams.port; const auto& af = IPv6Enabled() ? AF_UNSPEC : AF_INET; bool localhost_only = true; - std::vector addrs; - if (!bind_ip.empty()) { - boost::split(addrs, bind_ip, boost::is_any_of(","), boost::token_compress_on); - } for (const auto& addr : addrs) { // Get all addresses associated with each named bind host. // If we find any that are valid external identifiers, -- cgit v1.2.1