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 567e67c
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions src/ripple/overlay/impl/OverlayImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,11 +538,15 @@ 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);
}
else
{
ips.push_back (to_string (addr));
}

ips.push_back (to_string (addr));
}

std::string const base ("config: ");
Expand All @@ -558,8 +562,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 567e67c

Please sign in to comment.