Skip to content

Commit

Permalink
Append default port (51235) in [ips] and [ips_fixed] when no port is …
Browse files Browse the repository at this point in the history
…specified

FIXES: XRPLF#2861
  • Loading branch information
gregtatcam committed Jan 28, 2020
1 parent 90d9ca9 commit 7cad39b
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions src/ripple/overlay/impl/OverlayImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,11 +538,16 @@ OverlayImpl::onPrepare()
{
if (addr.port () == 0)
{
Throw<std::runtime_error> ("Port not specified for "
"address:" + addr.to_string ());
JLOG(journal_.debug()) << "Port not specified (bootstrapIps) for address:"
<< addr.to_string ()
<< ", using default port 51235";
beast::IP::Endpoint addr_default(addr.address(), 51235);
ips.push_back (to_string (addr_default));
}
else
{
ips.push_back (to_string (addr));
}

ips.push_back (to_string (addr));
}

std::string const base ("config: ");
Expand All @@ -558,8 +563,28 @@ OverlayImpl::onPrepare()
std::string const& name,
std::vector <beast::IP::Endpoint> const& addresses)
{
if (!addresses.empty ())
m_peerFinder->addFixedPeer (name, addresses);
std::vector <beast::IP::Endpoint> addresses_update;
addresses_update.reserve(addresses.size());
for (auto const& addr : addresses)
{
if (addr.port () == 0)
{
JLOG(journal_.debug()) << "Port not specified (ips_fixed) for address:"
<< addr.to_string ()
<< ", using default port 51235";
beast::IP::Endpoint addr_default(addr.address(), 51235);
addresses_update.push_back(addr_default);
}
else
{
addresses_update.push_back(addr);
}
}

if (!addresses_update.empty())
{
m_peerFinder->addFixedPeer (name, addresses_update);
}
});
}
}
Expand Down

0 comments on commit 7cad39b

Please sign in to comment.