mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Update the default port for [ips] and [ips_fixed]:
If a port number is not specified in the [ips] or [ips_fixed] blocks, automatically add the new default peer port which was registered with IANA: 2459. Also use 2459 if no port is specified with manually using the `connect` command; previously it was using 6561, which could have resulted in spurious failures. This commit, if merged, fixes #2861.
This commit is contained in:
committed by
manojsdoshi
parent
2d23e7bd18
commit
645c06764b
@@ -554,13 +554,8 @@ OverlayImpl::onPrepare()
|
|||||||
for (auto const& addr : addresses)
|
for (auto const& addr : addresses)
|
||||||
{
|
{
|
||||||
if (addr.port() == 0)
|
if (addr.port() == 0)
|
||||||
{
|
ips.push_back(to_string(addr.at_port(DEFAULT_PEER_PORT)));
|
||||||
Throw<std::runtime_error>(
|
else
|
||||||
"Port not specified for "
|
|
||||||
"address:" +
|
|
||||||
addr.to_string());
|
|
||||||
}
|
|
||||||
|
|
||||||
ips.push_back(to_string(addr));
|
ips.push_back(to_string(addr));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,8 +572,19 @@ OverlayImpl::onPrepare()
|
|||||||
[this](
|
[this](
|
||||||
std::string const& name,
|
std::string const& name,
|
||||||
std::vector<beast::IP::Endpoint> const& addresses) {
|
std::vector<beast::IP::Endpoint> const& addresses) {
|
||||||
if (!addresses.empty())
|
std::vector<beast::IP::Endpoint> ips;
|
||||||
m_peerFinder->addFixedPeer(name, addresses);
|
ips.reserve(addresses.size());
|
||||||
|
|
||||||
|
for (auto& addr : addresses)
|
||||||
|
{
|
||||||
|
if (addr.port() == 0)
|
||||||
|
ips.emplace_back(addr.address(), DEFAULT_PEER_PORT);
|
||||||
|
else
|
||||||
|
ips.emplace_back(addr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ips.empty())
|
||||||
|
m_peerFinder->addFixedPeer(name, ips);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,4 +61,7 @@ static std::uint32_t constexpr XRP_LEDGER_EARLIEST_SEQ{32570};
|
|||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|
||||||
|
/** Default peer port (IANA registered) */
|
||||||
|
inline std::uint16_t constexpr DEFAULT_PEER_PORT{2459};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#include <ripple/net/RPCErr.h>
|
#include <ripple/net/RPCErr.h>
|
||||||
#include <ripple/overlay/Overlay.h>
|
#include <ripple/overlay/Overlay.h>
|
||||||
#include <ripple/protocol/ErrorCodes.h>
|
#include <ripple/protocol/ErrorCodes.h>
|
||||||
|
#include <ripple/protocol/SystemParameters.h>
|
||||||
#include <ripple/protocol/jss.h>
|
#include <ripple/protocol/jss.h>
|
||||||
#include <ripple/rpc/Context.h>
|
#include <ripple/rpc/Context.h>
|
||||||
#include <ripple/rpc/impl/Handler.h>
|
#include <ripple/rpc/impl/Handler.h>
|
||||||
@@ -53,7 +54,7 @@ doConnect(RPC::JsonContext& context)
|
|||||||
if (context.params.isMember(jss::port))
|
if (context.params.isMember(jss::port))
|
||||||
iPort = context.params[jss::port].asInt();
|
iPort = context.params[jss::port].asInt();
|
||||||
else
|
else
|
||||||
iPort = 6561;
|
iPort = DEFAULT_PEER_PORT;
|
||||||
|
|
||||||
auto ip =
|
auto ip =
|
||||||
beast::IP::Endpoint::from_string(context.params[jss::ip].asString());
|
beast::IP::Endpoint::from_string(context.params[jss::ip].asString());
|
||||||
|
|||||||
Reference in New Issue
Block a user